13.07.2015 Views

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

An Operating Systems Vade Mecum

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Inter-process communication 297When simulated by the programming language, we call the programming-languageprocesses threads to distinguish them from operating-system processes. As far asthe operating system is concerned, there is only one process. The run-time supportroutines for the language include a scheduler that switches among the threads.This approach allows threads to share data (within the scope rules of the language)without involving the operating system in data-security issues.When simulated by the operating system, the process-creation construct of thelanguage is implemented by asking the operating system to start a new process.Shared data require that the operating system assist by letting the processes sharepart of their virtual space.2 INTER-PROCESS COMMUNICATION2.1 SemaphoresThe fact that one process can wait for another to finish is a simple form of communicationthat involves only synchronization. As we saw in Chapter 8, the kernel can makesemaphores available to processes through service calls for creation and use. For severalprocesses to share the semaphore, we must have some way for them to discover thesemaphore name. In Chapter 8, we suggested that semaphores be inheritable. Alternatively,semaphore identifiers could be passed in messages (described shortly) or placed inshared files.2.2 Virtual interruptsWe have already seen virtual interrupts in Chapter 5 as a way for processes to beinformed that asynchronous transput has completed. They can also be used as a primitiveform of inter-process communication. We can introduce a service call that lets one processcause a virtual interrupt in another.Interrupt(process number, interrupt number). This call sends the given interruptto the given process, if permitted.In order to prevent processes from sending unwanted interrupts to arbitrary processes, wemight want to restrict interrupts in any of the following ways:

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!