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:

  • source program A source program is a series of valid statements for a specific programming language (such as C or C++). The source program is stored in a plain ASCII text file. For purposes of our discussion we will consider a plain ASCII text file to be one that contains characters represented by the ASCII values in the range of 32127. Such source files can be displayed to the screen or printed on a line printer. Under most conditions, the access permissions on the source file are set as nonexecutable. A sample C++ language source program is shown in Program 1.1.
  • executable program An executable program is a source program that, by way of a translating program such as a compiler, or an assembler, has been put into a special binary format that the operating system can execute (run). The executable program is not a plain ASCII text file and in most cases is not displayable on the terminal or printed by the user .

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
 }

Programs and Processes

Processing Environment

Using Processes

Primitive Communications

Pipes

Message Queues

Semaphores

Shared Memory

Remote Procedure Calls

Sockets

Threads

Appendix A. Using Linux Manual Pages

Appendix B. UNIX Error Messages

Appendix C. RPC Syntax Diagrams

Appendix D. Profiling Programs

show all menu





Interprocess Communication in Linux
Interprocess Communications in Linux: The Nooks and Crannies
ISBN: 0130460427
EAN: 2147483647
Year: 2001
Pages: 136
Similar book on Amazon

Flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net