Processes and threads

Basic idea

A process is the OS’s unit of resource allocation (address space, open files); a thread is its unit of scheduling. New processes are usually created by fork (duplicate) + exec (replace image), with copy-on-write avoiding the actual copy.

Key facts

A process encapsulates the basic resources of memory and processor time. It also encapsulates other higher level resources. Each process:

Creation of a new process

The operating system usually provides a way to create processes. in UNIX the fork system call is used to duplicate the callers address space, creating a new address space for a new process.

Copy on write

When a new process is created via fork, the address space is copied. The new process code is identical and is usually read-only so that it can be shared in real memory and no actual copying of memory is required. This is fater and more efficient than making a copy. Copy on write is a technique that makes a copy of a memory region only when the new process actually writes to it.

New processes on distributed systems

In a distributed system there is a choice as to where the new process will be created on. In a distributed operating system, this choice is made by the operating system. The decision is largely a matter of policy and some categories are:

Process migration

Processes can be migrated from one host to another by copying their address space. Depending on the platform and on the resources that are in current use by the process, process migration can be more or less difficult. Process code is often CPU dependant, this obviously introduces heterogenity issues.

Siblings