Introduction

Fundamental to all operating systems is the concept of a process . A process is a dynamic entity scheduled and controlled by the operating system. While somewhat abstract, a process consists of an executing (running) program, its current values, state information, and the resources used by the operating system to manage the process. In a UNIX-based operating system, such as Linux, at any given point in time, multiple processes appear to be executing concurrently. From the viewpoint of each of the processes involved, it appears they have access to and control of all system resources as if they were in their own standalone setting. Both viewpoints are an illusion. The majority of operating systems run on platforms that have a single processing unit capable of supporting many active processes. However, at any point in time, only one process is actually being worked upon. By rapidly changing the process it is currently executing, the operating system gives the appearance of concurrent process execution. The ability of the operating system to multiplex its resources among multiple processes in various stages of execution is called multiprogramming (or multitasking ). Systems with multiple processing units, which by definition can support true concurrent processing, are called multiprocessing .

As noted, part of a process consists of the execution of a program . A program is an inactive, static entity consisting of a set of instructions and associated data.

If a program is invoked multiple times, it can generate multiple processes. We can consider a program to be in one of two basic formats:

Program 1.1 A source program in C++.

File : p1.1.cxx /* Display Hello World 3 times */ #include + #include // needed for write #include // needed for strcpy #include // needed for exit using namespace std; char *cptr = "Hello World "; // static by placement 10 char buffer1[25]; int main( ){ void showit(char *); // function prototype int i = 0; // automatic variable strcpy(buffer1, "A demonstration "); // library function + write(1, buffer1, strlen(buffer1)+1); // system call for ( ; i < 3; ++i) showit(cptr); // function call return 0; } 20 void showit( char *p ){ char *buffer2; buffer2= new char[ strlen(p)+1 ]; strcpy(buffer2, p); // copy the string cout << buffer2; // display string + delete [] buffer2; // release location }

Категории