Presentation is loading. Please wait.

Presentation is loading. Please wait.

CGS 3763 Operating Systems Concepts Spring 2013

Similar presentations


Presentation on theme: "CGS 3763 Operating Systems Concepts Spring 2013"— Presentation transcript:

1 CGS 3763 Operating Systems Concepts Spring 2013
Dan C. Marinescu Office: HEC 304 Office hours: M-Wd 11: :30 AM

2 11/28/2018

3 Lecture 12 – Monday, February 4, 2013
Last time: Answers to student questions Today: Creation and termination of processes Inter-process communication Message passing Sockets Next time Client-server systems Remote procedure call Reading assignments Chapters 3 and 4 of the textbook Chapters 3 and 4 textbook slides 11/28/2018

4 Process Creation A parent process create children processes, which, in turn create other processes, forming a tree of processes A process is identified by a process identifier (pid) Possible resource sharing strategies between parent and children Parent and children share all resources Children share subset of parent’s resources Parent and child share no resources Execution Parent and children execute concurrently Parent waits until children terminate

5 Process Creation (Cont’d)
Address space Child duplicate of parent Child has a program loaded into it UNIX examples fork system call creates new process exec system call used after a fork to load in the address space of the child process a new program

6 Process Creation – the parent waits until the child process terminates

7 Pid – the process ID In UNIX-like operating systems
The current process ID is provided by a getpid() system call. The process ID of a parent process can be obtained with the getppid() system call. In Windows one can get the ID of the current process using GetCurrentProcessId()  the ID of other processes using  GetProcessId() 11/28/2018

8 C Program Forking Separate Process
int main() { pid_t pid; /* fork another process */ pid = fork(); if (pid < 0) { /* error occurred */ fprintf(stderr, "Fork Failed"); exit(-1); } else if (pid == 0) { /* child process */ execlp("/bin/ls", "ls", NULL); else { /* parent process */ /* parent will wait for the child to complete */ wait (NULL); printf ("Child Complete"); exit(0);

9 System processes swapper or sched has PID=0 and is responsible for paging, and is a kernel process (daemon) init – in Unix-based computer systems, init (short for initialization) is a daemon, the direct/indirect ancestor of all other processes. Init is the first process started during booting, and is typically assigned PID =1. inetd (internet service daemon) is a daemon on Unix systems that manages Internet services. It  listens on designated ports used by Internet services such as FTP, POP3, and telnet. When a TCP packet or an UDP packet arrives with a particular destination port number, inetd launches the appropriate server program to handle the connection e.g., telnetd. Telnetd – Telnet daemon process handling communication using the Telnet protocol 11/28/2018

10 OS shells Operating system shell  a software that presents a user interface to various OS functions (e.g., process and file management) and services. C shell (csh) is a Unix shell   a command processor typically run in a text window, allowing the user to type commands. The C shell can also read commands from a file, called a script. On Mac OS X and Red Hat Linux, csh is actually tcsh, an improved version of csh. On Debian, Ubuntu, and their derivatives, there are two different packages: csh and tcsh. 11/28/2018

11 A tree of processes on a typical Solaris

12 Process Termination Process executes last statement and asks the operating system to delete it (exit) Output data from child to parent (via wait) Process’ resources are deallocated by operating system Parent may terminate execution of children processes (abort) Child has exceeded allocated resources Task assigned to child is no longer required If parent is exiting Some operating system do not allow child to continue if its parent terminates All children terminated - cascading termination

13 Interprocess communication
Processes within a system may be independent cooperating A process can affect or be affected by other processes, including sharing data Reasons for cooperating processes: Information sharing Computation speedup Modularity Convenience IPC - interprocess communication. Two models: Shared memory Message passing

14 Communications models
Message passing Shared memory

15 Asynchronicity Asynchronous events occur independently of the main program flow. Asynchronous actions  executed in a non-blocking scheme, allowing the main program flow to continue processing. Asynchronous I/O   input/output processing that permits a processing to continue before the I/O operations has finished. Asynchronous processes do not share a clock Asynchronous communication  the sender does not wait to receive an acknowledgment from the receiver. 11/28/2018


Download ppt "CGS 3763 Operating Systems Concepts Spring 2013"

Similar presentations


Ads by Google