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.

64 Space Management Chapter 3Whether the new process is split or loaded, it usually comes into being as a resultof a service call submitted by another process. We will often call that instigator theparent and the new process the child. Service calls, as seen earlier, are like procedureinvocations as far as the calling process is concerned. We will describe service calls byprocedure headings and will set them off from the rest of the text with a square symbol(). The kernel might provide two calls of interest here:Load(file name). This call tells the operating system to take the load image storedin the named file and make it a new process.Split. This call creates a new process whose virtual space is identical to the virtualspace of the caller. The program counter of the child is set to the same value as theprogram counter of the parent.The storage manager must allocate backing store for either Split or Load. The loadimage itself can act as backing store for the parts of the virtual space that are notmodifiable, such as instructions and read-only data. In this way, processes that areformed by the Split call can share some backing store with their parents. Fresh backingstore must be allocated for all the non-shared, writable parts of the new virtual space,although this allocation may be delayed until the process actually modifies the contentsof its virtual store. (We discuss this technique, called copy on write, when we deal withsegmentation.)At the minimum, each service call must report back to the caller whether therequest was honored. If not, it is sometimes useful to the caller to have some idea ofwhat did not work. The error ‘‘NoRoom,’’ which might apply to either Load or Split,might be caused by one of a host of problems.Swap space is full on backing store.There are no available context blocks for the new process.The caller has the maximum number of children already.The caller’s user has the maximum number of processes already.Once a process is running, it may need to acquire more virtual store. New store hasseveral uses. To hold data structures whose size could not be determined until the programstarted to run To hold messages that will be sent to other processes (we discuss messages inChapter 9) To serve as buffers for transput (we discuss transput buffers in Chapter 5) To hold local variables and return addresses for procedure callsLater, a process may release this new space.Different storage-allocation schemes support such dynamic changes to differingextents. A simple set of service calls might look like this:GetStore(descriptor). This call returns the virtual address of the start of the additionalspace. The space is specified by the descriptor, which indicates the howmuch space the process needs. This call may require the storage manager to allocatenew backing store. The error ‘‘NoRoom’’ could apply to GetStore just as it

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

Saved successfully!

Ooh no, something went wrong!