ACSC 372 Systems Programming. exec() Functions. Outline

Size: px
Start display at page:

Download "ACSC 372 Systems Programming. exec() Functions. Outline"

Transcription

1 Outline ACSC 372 Systems Programming Lecture 12: Process & Signals (Chapter 8,10 - Stevens & Rago) exec() Functions (ch. 8.10) System Callsystem() (ch. 8.13) Signals in C (ch. 10.1, ch. 10.2, ch. 10.3) System Call signal() (ch. 10.3) Signals and Processes System Callalarm() (ch ) Inter-Process Signals (kill()) (ch. 10.9) 2 exec() Functions One use of the fork() function is to create a new process (the child) that then causes another program to be executed (an executable file, e.g. ls, sort, uniq, any executable!) by calling one of the exec functions. When a process calls one of the exec functions, that process is completely replaced by the new program, and the new program starts executing at its main function. A child process replaces its process image (its text, data, heap, and stack) with a brand new program from disk (an executable file), differentiating thus itself from its parent. The process ID does not change across an exec, because a new process is NOT created. After an exec, the new program inherits additional properties from the calling process, like PID, PPID, File Descriptors, alarms, etc. (see p. 234). 3 exec() Functions (cnt d) There are 6 different exec functions; we are interested of the following: int execl(char *pathname, char *arg0, char *arg1,..., char *argn, NULL); int execv(char *pathname, char *argv[]); Replace a process (text, data, heap, stack) with that of an executable file that is given in the pathname, where pathname is the relative or absolute path. Defines the end of the arg list (alternative definition (char *)0) int execlp(char *filename, char *arg0, char *arg1,..., char *argn, NULL); int execvp(char *filename, char *argv[]); where in filename, there is no need to define the location of the executable, since the executable file is searched for in the directories specified by the PATH environment variable. (This is useful for use in the case of e.g., sort, uniq, etc). All four return -1 on error, no return on success. The difference ofexecl(list) andexecv(vector) is that execl takes as arguments: arg0=«executable name», arg1=«parameter 1»,., argn=«parameter n», arg(n+1)=null, whereas inexecv we use an array of pointers to the arguments argv[0], argv[1],, argv[n], argv[n+1]=null. The same difference applies to the pair execlp(list,path) / execvp (vector,path). All the above functions are library functions that are based on the system call execve (vector environment). 4

2 Example 1 Use of execl() Write a program that list the contents of the parent directory (..), using the execl function. Example 1 Use of execl() (cnt d) /* File: execl_demo.c */ #include <stdio.h> main() printf("i am process %d and I will execute an 'ls -l..' \n", getpid()); if (execl("/bin/ls", "ls", "-l", "..", NULL) == -1) perror("execl"); Sample Execution $./execl_demo I am process and I will execute an 'ls -l..' total 504 drwxr--r-x 7 com.chc staff 4096 Jan test1 drwx--x--x 44 com.chc staff 4096 Feb 9 14:58 test2 drwx-----x 53 com.chc staff Sep 17 21:50 test Example 2 Use of execvp() Problem Description #include <stdio.h> /* For printf */ Create a child process that will execute the date int main() command. When the child terminates, the parent process continues its execution. int pid, status; char *argv[2]; if ((pid = fork()) == -1) /* Check for error */ perror("fork"); exit(1); else if (pid == 0) /* Child process */ argv[0] = "date"; argv[1] = NULL; printf("i am child process %d and I will replace myself by 'date'\n", getpid()); if (execvp("date", argv) == -1 ) perror("execvp"); exit(1); else /* Parent process */ printf("i am parent process %d\n", getpid()); if (wait(&status)!= pid) /* Wait for child */ perror("wait"); exit(1); printf("child terminated with exit code %d\n", status >> 8); exit(0); Sample Execution $./execvp-example2 I am parent process I am child process and I will replace myself by 'date' Mon Mar 3 19:14:11 EET 2009 Child terminated with exit code 0 7 Example 3 - Implementation of a simple shell using execvp() Write a C program that operates like a simple shell: It takes commands from the keyboard that are executed by a child process, which is created each time. 8

3 Example 3 - (cnt d) Implementation of a simple shell using execvp() /* File: simpleshell.c */ #include <stdio.h> /* For fgets, printf */ void parse(char *buf, char **argv); /* Function prototype */ void execute(char **argv); /* Function prototype */ int main() char buf[1024]; char *argv[64]; while (1) printf("command: "); /* Get input */ buf if (fgets(buf, sizeof(buf), stdin) == NULL) printf("\n"); exit(0); parse(buf, argv); /* Split buf into arguments copied into argv */ execute(argv); return 0; Get user command into Example 3 - (cnt d) Implementation of a simple shell using execvp() // Does not support pipes, redirections void parse(char *buf, char **argv) char *tmp; // used to perform a linear scan of buf tmp = buf; // initialize tmp to the same position with buf while (*tmp!= '\0') if ((*tmp == ' ') (*tmp == '\t') (*tmp == '\n')) *tmp = '\0'; // replace whitespace with NULL *argv++ = buf; // first set *argv=buf then *argv++ buf = ++tmp; // set buf to the next string tmp++; *argv=null; /* End of arguments */ Memory fork() Parent Wait() A child Execvp() tmp e.g. buf= ls a l i Argv[ 0,1,2,3,NULL ] void execute(char **argv) int pid, status; if ((pid = fork()) < 0) /* Create a child */ perror("fork"); exit(1); if (pid == 0) /* Child process */ if (execvp(argv[0], argv) == -1) perror(argv[0]); exit(1); if (wait(&status)!= pid) /* Parent process */ perror("wait"); exit(1); 9 10 System Callsystem() It is convenient to execute a command string from within a program, e.g. Memory system() int main() system("ls -al sort > output.txt"); exit(0); int system(const char *cmdstring); returns -1 on error or 0 ΟΚ A a) fork() B c) waitpid() b) exec() The C program waits until the system() is completed. system() is implemented by calling fork (child), exec (child), and waitpid (parent process waits its child process to terminate). (see example in Fig (p. 247)) Example -system() Find the total number of processes that are created when the program sysexec.c is executed, which uses system() to call the bash script batch.sh. $ cat sysexec.c int main() system("./batch.sh"); exit(0); $cat./batch.sh i=0; while [ $i -lt 1000 ]; do echo -n " $i "; ls -al sort uniq rev > /tmp/file; ((i++)); done 11 12

4 Example -system() (cnt d) The execution of sysexec(14015) creates a new process sh(14016) that does 1000 iterations. In each of the 1000 iterations, 4 processes are created (ls, sort, uniq, rev). Remember that ls, sort, uniq, rev are not built-in shell commands (that is, they are not in the executable file of the shell). Thus each time they are called, a new process is created. Therefore, we have: 4*1000 (ls, sort, uniq, rev) + 1 (sysexec(14015)) + 1 (sh(14016)) = 4002 processes Below, 2 from the 1000 instances are shown using the command pstree. $ pstree -Gp com.chc sshd(4588) bash(4590) a.out(14015) sh(14016) ls(16806) rev(16809) sort(16807) uniq(16808) $ pstree -Gp com.chc sshd(4588) bash(4590) a.out(14015) sh(14016) ls(17669) rev(17672) sort(17670) uniq(17671) Signals Signals (software interrupts): Small messages, which are sent to a specific process, or group of processes. Signals are sent between Process Process (if the appropriate permissions are given, e.g. kill) or from the kernel to a Process (e.g. alarm()) When a process receives a signal, the process execution is interrupted, and the signal is handled. It can ignore the signal (not all) It can handle the signal, by executing a specific part of code that is called signal handler. In this lecture, we will study Signals as part of C programs, whereas in lecture 8 we have seen Signals in shells Signals (cnt d) User Mode Main Memory Signals (cnt d) Kernel Mode Signals Bash Shell Bash Shell Signals Signals Signals Software Interrupts Signals Handling Each Signal in UNIX consists of: a number (e.g., 2) or an equivalent symbolic name (e.g., SIGINT), a default signal handler, which in most cases can be modified/changed and replace the way a program handles a signal. In order to program Signals in C, we need to include the library: Hardware Interrupts 15 16

5 Signals (cnt d) Signals (cnt d) default signal handler See Table 10.1 (p. 292) for other signals SIGHUP (1) terminal line got hung-up SIGINT (2) interrupt (Control^C) SIGKILL (9) kill SIGUSR1 (10) user-defined signal 1 SIGSEGV (11) Segm. Viol. invalid memory reference SIGUSR2 (12) user-defined signal 2 SIGALRM (14) alarm clock SIGTERM (15) software termination signal (like 2) SIGCONT (18) continue after stop SIGSTOP (19) stop (cannot be caught or ignored). SIGTSTP (20) stop signal from keyboard (Control^Z) System Callsignal() void (*signal( int sigcode, void (*func)(int) )) (int) ; Defines the response of a process when a sigcode signal is received. We thus define which function contains the commands of the response. sigcode (int): The integer value (name) of the signal that we want to handle (e.g., SIGINT (2) see previous slide). void (*func)(int): Pointer to the function that will handle the signal. The value of func is a) the constant SIG_IGΝ (ignore), thus the signal is ignored, b) the constant SIG_DFL, thus the signal handling is done by the default signal handler (in case that we have changed the signal handler for a specific signal), or c) the address of a function to be called when the signal occurs (a user-defined function that plays the role of the signal handler). When the signal handler is called, its single integer argument is the number of the signal that activates the signal handler. It Returns: a pointer to the previous signal handler of the sigcode signal (e.g. if we want to temporarily change the signal handler, and afterwards to restore it), or -1 (on error). The sigcode: SIGKILL and SIGSTOP cannot be ignored, neither we can change their signal handler. void cntl_c_handler(int sig) printf("just received signal %d\n", sig); main() signal(sigint, cntl_c_handler); System Callsignal() Example 1 while(1) printf("\n"); sleep(1); Signal number that activates the signal handler Sample execution $./simplesignal Just received signal 2 Just received signal 2 Just received signal

6 System Callsignal() Example 2 An old myth An old myth says that a student used the following code in his program, to be certain that he will never get coredumps when his program is examined. Note that SIGSEGV (segmentation violation) is a signal that is sent by the kernel to state that the process has done an invalid memory reference. #include <stdio.h> void segv_handler(int dummy) fprintf(stderr, "nfs server not responding, still trying\n"); while(1) sleep(1); int main(void) int *iptr; signal(sigsegv, segv_handler); *iptr = 12; printf("value is: %d\n", *iptr); return 0; 21 System Callsignal() Example 3 #include <stdio.h> /* For printf */ /* For SIGINT, SIG_IGN */ main() void (*oldhandler)(int); /* To hold old handler value */ printf("i can be Control-C'ed\n"); sleep(3); oldhandler = signal(sigint, SIG_IGN); /* Ignore ^C */ printf("i am protected from Control-C now\n"); sleep(3); signal(sigint, oldhandler); /* Restore old handler */ printf("i can be Control-C'ed again\n"); sleep(3); printf("bye!\n"); $./critical I can be Control-C'ed ^C $./critical I can be Control-C'ed I am protected from Control-C now ^CI can be Control-C'ed again Bye! $./critical I can be Control-C'ed I am protected from Control-C now I can be Control-C'ed again ^C 22 $ #include <stdio.h> void mysignalh(int sig) if (sig == SIGUSR1) printf("\nreceived SIGUSR1(%d) signal\n,sig); if (sig == SIGUSR2) printf("\nreceived SIGUSR2(%d) signal\n,sig); main() signal(sigusr1, mysignalh); signal(sigusr2, mysignalh); System Call signal() Example 4 while(1) sleep(1); bash-3.1$./a.out & [1] bash-3.1$ kill -USR bash-3.1$ received SIGUSR1(10) signal bash-3.1$ kill -USR received SIGUSR2(12) signal bash-3.1$ bash-3.1$ kill -KILL bash-3.1$ [1]+ Killed./a.out bash-3.1$ Signals and Processes If we declare a signal handler and thenfork, this signal handler also applies for the child process. void signal_handler(int sig) printf("a signal %d was received by %d \n", sig, getpid()); int main(void) pid_t pid; /* Install signal handler */ signal(sigint, signal_handler); if ( (pid = fork()) < 0) perror("fork error"); else if (pid == 0) while (1) printf("\n"); sleep(1); else printf("parent has finished\n"); exit(0); Note that we have an orphan process In order to verify that the child process receives the signal, we can send the signal from the shell: $kill We then see that the signal is received by the child (4256) parent has finished A signal 2 was received by

7 Signals and Processes: Avoid Zombies asynchronously using Signals In lecture 11 (last example) we have seen how to avoid having zombies in a synchronous way. That is, we execute wait() until the child process returns its exit code. This however stopped the execution of the parent process (at wait()) until the child s response (that is, the parent is in the blocking wait state). Now we will see an alternative, and better way of avoiding zombies asynchronously. We make use of the signal SIGCHLD, that is sent by the child to its parent process, when the child process terminates. 25 void signal_handler(int sig) int pid; int status; printf( #%d: A signal %d was received \n", getpid(), sig); pid = wait(&status); printf( #%d: Exit Code %d %d\n", getpid(), pid, status>>8); Signals and Processes: Example Avoid Zombies asynchronously using Signals int main() int pid; signal(sigchld, signal_handler); /* Install signal handler */ pid = fork(); if (pid == -1) /* Check for error */ perror("fork"); exit(1); else if (pid == 0) /* The child process */ printf( #%d (child): Exit!\n, getpid()); exit(37); /* Exit with a silly number */ else /* The parent process */ while (1) /* Never terminate */ sleep(1000); Putwait() inside the signal_handle, so as the child can return its exit code, independent with how busy its parent process is. This way limits the zombie processes. Sample Execution $./chldsignal #19246 (child): Exit! #19245: A signal 17 was received #19245: Exit Code System Call alarm() unsigned int alarm(unsigned int count); Returns 0 or number of seconds until previously set alarm. Instructs the kernel to send, after count seconds, the signal SIGALRM to the calling process. The default signal handler prints the message Alarm clock, and terminates the process. The counter is kept in the kernel. If the function is called with count equal to 0, the previous alarm clock is cancelled. The number of seconds left for that previous alarm clock is returned as the value of the function. Observations: The alarm is NOT inherited by the child process. The alarm is reset each time SIGALRM is sent to the process; thus we need to re-set the alarm clock, if we want to receive the signal again (see example). System Callalarm() Example // signal, alarm // fork, getpid #include <time.h> // time_t, time void signal_handler(int sig) time_t rawtime; time ( &rawtime ); /* compute the current time */ printf("#%d: The kernel sent a SIGALRM(%d) on: %s", getpid(), sig, ctime (&rawtime)); alarm(1); /* we re-install the alarm here */ int main() int pid; /* Install signal handler first, and then set the alarm clock */ signal(sigalrm, signal_handler); alarm(1); pid = fork(); if (pid == -1) perror("fork"); exit(1); else if (pid == 0) /* The child process */ while (1) printf("#%d\n", getpid()); sleep(3); else while (1) printf("#%d\n", getpid()); sleep(3); Alarm signal handler Sample Execution #6020 (child) #6019 (parent) #6019: The kernel sent a SIGALRM(14) on: Tue Mar 3 23:58: #6019 #6019: The kernel sent a SIGALRM(14) on: Tue Mar 3 23:58: #6019 #6019: The kernel sent a SIGALRM(14) on: Tue Mar 3 23:59: #6019 #6020 Only the parent receives the alarm 27 28

8 Inter-Process Signals System Callkill() Until now we have seen how we can send signals from the kernel (e.g. SIGALRM) and also from the shell (e.g. SIGINT) to a process. What if we want to send signals between processes? Use of the System Callkill int kill(int pid, int sigcode); Returns -1 on error, or 0 if OK Sends the sigcode signal to the process with process ID pid A process needs permission to send a signal to another process. The superuser can send a signal to any process. For inter-process signals sending, we can use the non-reserved signals SIGUSR1, SIGUSR2. 29 Inter-Process Signals Example System Callkill() /* File: pulse.c */ #include <stdio.h> /* For printf */ /* For SIGTERM, SIGSTOP, SIGCONT */ main() int pid1, pid2; if ((pid1 = fork()) == -1) perror("fork"); exit(1); if (pid1 > 0) /* parent */ if ((pid2 = fork()) == -1) perror("fork"); exit(1); if (pid1 == 0) /* First child */ while (1) /* Infinite loop */ printf("process 1 is alive\n"); sleep(1); if (pid2 == 0) /* Second child */ while (1) /* Infinite loop */ printf("\n"); sleep(1); sleep(2); kill(pid1, SIGSTOP); /* Suspend first child */ sleep(2); kill(pid1, SIGCONT); /* Resume first child */ sleep(2); kill(pid1, SIGTERM); /* Terminate first child */ kill(pid2, SIGTERM); /* Terminate second child */ Problem Create two child processes that each execute an infinite loop. We then suspend the 1 st child process, we resume it, and finally we terminate both child processes. $./a.exe Process 1 is alive Process 1 is alive Process 1 is alive Process 1 is alive 30

System Programming. Signals I

System Programming. Signals I Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Introduction 2 3 Signals

More information

Lesson 3. The func procedure allows a user to choose the action upon receipt of a signal.

Lesson 3. The func procedure allows a user to choose the action upon receipt of a signal. Lesson 3 Signals: When a process terminates abnormally, it usually tries to send a signal indicating what went wrong. C programs can trap these for diagnostics. Software interrupts: Stop executing the

More information

System Programming. Signals II

System Programming. Signals II Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Suspending a process 2

More information

CSC 1600 Unix Processes. Goals of This Lecture

CSC 1600 Unix Processes. Goals of This Lecture CSC 1600 Unix Processes q Processes Goals of This Lecture q Process vs. program q Context switching q Creating a new process q fork: process creates a new child process q wait: parent waits for child process

More information

Preview. Process Termination. wait and waitpid() System Call. wait and waitpid() System Call. waitpid() System Call 10/23/2018

Preview. Process Termination. wait and waitpid() System Call. wait and waitpid() System Call. waitpid() System Call 10/23/2018 Preview Process Termination The waitpid() System Call The system() System Call Concept of Signals Linux Signals The signal System Call Unreliable Signals Signal() System Call The kill() and raise() System

More information

Processes & Signals. System Runs Many Processes Concurrently. State consists of memory image + register values + program counter

Processes & Signals. System Runs Many Processes Concurrently. State consists of memory image + register values + program counter Processes & Signals Topics Process Hierarchy Shells Signals The World of Multitasking System Runs Many Processes Concurrently Process: executing program State consists of memory image + register values

More information

Signals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Signals. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Signals Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Multitasking (1) Programmer s model of multitasking fork() spawns new process Called once,

More information

Computer Science & Engineering Department I. I. T. Kharagpur. Operating System: CS rd Year CSE: 5th Semester (Autumn ) Lecture VII

Computer Science & Engineering Department I. I. T. Kharagpur. Operating System: CS rd Year CSE: 5th Semester (Autumn ) Lecture VII Computer Science & Engineering Department I. I. T. Kharagpur Operating System: CS33007 3rd Year CSE: 5th Semester (Autumn 2006-2007) Lecture VII Goutam Biswas Date: 4th September, 2006 1 Signals Signals

More information

CS213. Exceptional Control Flow Part II. Topics Process Hierarchy Signals

CS213. Exceptional Control Flow Part II. Topics Process Hierarchy Signals CS213 Exceptional Control Flow Part II Topics Process Hierarchy Signals ECF Exists at All Levels of a System Exceptions Hardware and operating system kernel software Concurrent processes Hardware timer

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 20

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 20 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 20 LAST TIME: UNIX PROCESS MODEL Began covering the UNIX process model and API Information associated with each process: A PID (process ID) to

More information

Signals. Joseph Cordina

Signals. Joseph Cordina 1 Signals Signals are software interrupts that give us a way to handle asynchronous events. Signals can be received by or sent to any existing process. It provides a flexible way to stop execution of a

More information

Shell and Signals. Computer Organization 3/17/2015. CSC252 - Spring The World of Multiprogramming or Multitasking. Unix Process Hierarchy

Shell and Signals. Computer Organization 3/17/2015. CSC252 - Spring The World of Multiprogramming or Multitasking. Unix Process Hierarchy Shell and Signals Kai Shen The World of Multiprogramming or Multitasking System runs many processes concurrently Process: executing program State includes memory image + register values + program counter

More information

Multitasking. Programmer s model of multitasking. fork() spawns new process. exit() terminates own process

Multitasking. Programmer s model of multitasking. fork() spawns new process. exit() terminates own process Signals Prof. Jin-Soo Kim( jinsookim@skku.edu) TA JinHong Kim( jinhong.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Multitasking Programmer s model of multitasking

More information

SOFTWARE ARCHITECTURE 3. SHELL

SOFTWARE ARCHITECTURE 3. SHELL 1 SOFTWARE ARCHITECTURE 3. SHELL Tatsuya Hagino hagino@sfc.keio.ac.jp slides URL https://vu5.sfc.keio.ac.jp/sa/login.php 2 Software Layer Application Shell Library MIddleware Shell Operating System Hardware

More information

CS240: Programming in C

CS240: Programming in C CS240: Programming in C Lecture 17: Processes, Pipes, and Signals Cristina Nita-Rotaru Lecture 17/ Fall 2013 1 Processes in UNIX UNIX identifies processes via a unique Process ID Each process also knows

More information

Processes. Processes (cont d)

Processes. Processes (cont d) Processes UNIX process creation image-file arg1 arg2 Shell command line example ls -l Equivalent to /bin/ls -l Why? How do you find out where the image file is? Background processes ls -l & Execute a process

More information

CS 550 Operating Systems Spring Process III

CS 550 Operating Systems Spring Process III CS 550 Operating Systems Spring 2018 Process III 1 Recap: Memory Layout of a typical process MAX Stack Function Call Arguments, Return Address, Return Values Gap Heap Data Dynamically allocated memory

More information

Programming Assignments will be.. All the PAs are continuous 3 major factors that you should consider

Programming Assignments will be.. All the PAs are continuous 3 major factors that you should consider Signals Prof. Jin-Soo Kim( jinsookim@skku.edu) TA - Dong-Yun Lee (dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu NOTICE Programming Assignments will be.. All

More information

Operating Systemss and Multicore Programming (1DT089)

Operating Systemss and Multicore Programming (1DT089) Operating Systemss and Multicore Programming (1DT089) Problem Set 1 - Tutorial January 2013 Uppsala University karl.marklund@it.uu.se pointers.c Programming with pointers The init() functions is similar

More information

Process Control. Philipp Koehn. 23 April 2018

Process Control. Philipp Koehn. 23 April 2018 Process Control Philipp Koehn 23 April 2018 Control Flow 1 The CPU executes one instruction after another Typically, they are next to each other in memory (unless jumps, branches, and returns from subroutine)

More information

KING FAHD UNIVERSITY OF PETROLEUM AND MINERALS Information and Computer Science Department ICS 431 Operating Systems Lab # 6

KING FAHD UNIVERSITY OF PETROLEUM AND MINERALS Information and Computer Science Department ICS 431 Operating Systems Lab # 6 Objective: KING FAHD UNIVERSITY OF PETROLEUM AND MINERALS Information and Computer Science Department ICS 431 Operating Systems Lab # 6 Inter-Process Communication (IPC) using Signals Now that we know

More information

Altering the Control Flow

Altering the Control Flow Altering the Control Flow Up to Now: two mechanisms for changing control flow: Jumps and branches Call and return using the stack discipline. Both react to changes in program state. Insufficient for a

More information

Unix-Linux 2. Unix is supposed to leave room in the process table for a superuser process that could be used to kill errant processes.

Unix-Linux 2. Unix is supposed to leave room in the process table for a superuser process that could be used to kill errant processes. Unix-Linux 2 fork( ) system call is successful parent suspended child created fork( ) returns child pid to parent fork( ) returns zero value to child; zero is the pid of the swapper/scheduler process both

More information

Altering the Control Flow

Altering the Control Flow Altering the Control Flow Up to Now: two mechanisms for changing control flow: Jumps and branches Call and return using the stack discipline. Both react to changes in program state. Insufficient for a

More information

Computer Science 330 Operating Systems Siena College Spring Lab 5: Unix Systems Programming Due: 4:00 PM, Wednesday, February 29, 2012

Computer Science 330 Operating Systems Siena College Spring Lab 5: Unix Systems Programming Due: 4:00 PM, Wednesday, February 29, 2012 Computer Science 330 Operating Systems Siena College Spring 2012 Lab 5: Unix Systems Programming Due: 4:00 PM, Wednesday, February 29, 2012 Quote: UNIX system calls, reading about those can be about as

More information

Process. Signal #8. Signals are software interrupts from unexpected events. a power failure. an alarm clock. the death of a child process

Process. Signal #8. Signals are software interrupts from unexpected events. a power failure. an alarm clock. the death of a child process Linux/UNIX Programming 문양세강원대학교 IT특성화대학컴퓨터과학전공 Signals Signals are software interrupts from unexpected events an illegal operation (e.g., divide by 0) a power failure an alarm clock the death of a child

More information

Unix Processes 1 / 31

Unix Processes 1 / 31 Unix Processes 1/31 A Unix Process Instance of a program in execution. OS loads the executable in main-memory (core) and starts execution by accessing the first command. Each process has a unique identifier,

More information

Process Management! Goals of this Lecture!

Process Management! Goals of this Lecture! Process Management! 1 Goals of this Lecture! Help you learn about:" Creating new processes" Programmatically redirecting stdin, stdout, and stderr" (Appendix) communication between processes via pipes"

More information

Exceptional Control Flow Exists at All Levels of a System. Systemprogrammering 2007 Föreläsning 3 Exceptional Control Flow Part II

Exceptional Control Flow Exists at All Levels of a System. Systemprogrammering 2007 Föreläsning 3 Exceptional Control Flow Part II Systemprogrammering 2007 Föreläsning 3 Exceptional Control Flow Part II Topics Process Hierarchy Shells Signals Nonlocal jumps Exceptional Control Flow Exists at All Levels of a System Exceptions Hardware

More information

Signals. Goals of this Lecture. Help you learn about: Sending signals Handling signals

Signals. Goals of this Lecture. Help you learn about: Sending signals Handling signals Signals 1 Goals of this Lecture Help you learn about: Sending signals Handling signals and thereby How the OS exposes the occurrence of some exceptions to application processes How application processes

More information

ECF Exists at All Levels of a System Exceptional Control Flow Part II Oct. 22, 2002 Topics! Process Hierarchy! Shells! Signals!

ECF Exists at All Levels of a System Exceptional Control Flow Part II Oct. 22, 2002 Topics! Process Hierarchy! Shells! Signals! 15-213 The course that gives CMU its Zip! Exceptional Control Flow Part II Oct. 22, 2002 Topics! Process Hierarchy! Shells! Signals! Nonlocal jumps ECF Exists at All Levels of a System Exceptions! Hardware

More information

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized) Process management CSE 451: Operating Systems Spring 2012 Module 4 Processes Ed Lazowska lazowska@cs.washington.edu Allen Center 570 This module begins a series of topics on processes, threads, and synchronization

More information

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476 CSE 451: Operating Systems Winter 2015 Module 4 Processes Mark Zbikowski mzbik@cs.washington.edu Allen Center 476 2013 Gribble, Lazowska, Levy, Zahorjan Process management This module begins a series of

More information

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto

Ricardo Rocha. Department of Computer Science Faculty of Sciences University of Porto Ricardo Rocha Department of Computer Science Faculty of Sciences University of Porto For more information please consult Advanced Programming in the UNIX Environment, 3rd Edition, W. Richard Stevens and

More information

CSC209H Lecture 6. Dan Zingaro. February 11, 2015

CSC209H Lecture 6. Dan Zingaro. February 11, 2015 CSC209H Lecture 6 Dan Zingaro February 11, 2015 Zombie Children (Kerrisk 26.2) As with every other process, a child process terminates with an exit status This exit status is often of interest to the parent

More information

Processes & Threads. (Chapter 3) CS 4410 Operating Systems. [R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse]

Processes & Threads. (Chapter 3) CS 4410 Operating Systems. [R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse] Processes & Threads (Chapter 3) CS 4410 Operating Systems [R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse] Processes! 2 What is a Program? Program is a file containing: executable

More information

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D)

PROCESS CONTROL BLOCK TWO-STATE MODEL (CONT D) MANAGEMENT OF APPLICATION EXECUTION PROCESS CONTROL BLOCK Resources (processor, I/O devices, etc.) are made available to multiple applications The processor in particular is switched among multiple applications

More information

Assignment 1. Teaching Assistant: Michalis Pachilakis (

Assignment 1. Teaching Assistant: Michalis Pachilakis ( Assignment 1 Teaching Assistant: Michalis Pachilakis ( mipach@csd.uoc.gr) System Calls If a process is running a user program in user mode and needs a system service, such as reading data from a file,

More information

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534 CSE 410: Computer Systems Spring 2018 Processes John Zahorjan zahorjan@cs.washington.edu Allen Center 534 1. What is a process? Processes 2. What's the process namespace? 3. How are processes represented

More information

PVPSIDDHARTHA INSTITUTE OF TECHNOLOGY

PVPSIDDHARTHA INSTITUTE OF TECHNOLOGY 1 UNIT-V SIGNALS Program must sometimes deal with unexpected or unpredictable events, such as : a floating point error a power failure an alarm clock ring the death of a child process a termination request

More information

Operating System Structure

Operating System Structure Operating System Structure CSCI 4061 Introduction to Operating Systems Applications Instructor: Abhishek Chandra Operating System Hardware 2 Questions Operating System Structure How does the OS manage

More information

System Calls and Signals: Communication with the OS. System Call. strace./hello. Kernel. Context Switch

System Calls and Signals: Communication with the OS. System Call. strace./hello. Kernel. Context Switch System Calls and Signals: Communication with the OS Jonathan Misurda jmisurda@cs.pitt.edu System Call An operation (function) that an OS provides for running applications to use CS 1550 2077 strace./hello

More information

CS240: Programming in C

CS240: Programming in C CS240: Programming in C Lecture 16: Process and Signals Cristina Nita-Rotaru Lecture 16/ Fall 2013 1 Processes in UNIX UNIX identifies processes via a unique Process ID Each process also knows its parent

More information

Process Management 1

Process Management 1 Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Programmatically redirecting stdin, stdout, and stderr (Appendix) communication between processes via pipes Why?

More information

Process Management! Goals of this Lecture!

Process Management! Goals of this Lecture! Process Management! 1 Goals of this Lecture! Help you learn about:" Creating new processes" Programmatically redirecting stdin, stdout, and stderr" Unix system-level functions for I/O" The Unix stream

More information

Lesson 2. process id = 1000 text data i = 5 pid = 1200

Lesson 2. process id = 1000 text data i = 5 pid = 1200 Lesson 2 fork: create a new process. The new process (child process) is almost an exact copy of the calling process (parent process). In this method we create an hierarchy structure for the processes,

More information

Exceptional Control Flow Part II

Exceptional Control Flow Part II Exceptional Control Flow Part II William J. Taffe Plymouth State University Using the Slides of Randall E. Bryant Carnegie Mellon University Topics Process Hierarchy Shells Signals Nonlocal jumps ECF Exists

More information

Processes. Dr. Yingwu Zhu

Processes. Dr. Yingwu Zhu Processes Dr. Yingwu Zhu Process Growing Memory Stack expands automatically Data area (heap) can grow via a system call that requests more memory - malloc() in c/c++ Entering the kernel (mode) Hardware

More information

Giving credit where credit is due

Giving credit where credit is due CSCE 230J Computer Organization Exceptional Control Flow Part II Dr. Steve Goddard goddard@cse.unl.edu http://cse.unl.edu/~goddard/courses/csce230j Giving credit where credit is due Most of slides for

More information

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 18

CS24: INTRODUCTION TO COMPUTING SYSTEMS. Spring 2018 Lecture 18 CS24: INTRODUCTION TO COMPUTING SYSTEMS Spring 2018 Lecture 18 LAST TIME: OVERVIEW Expanded on our process abstraction A special control process manages all other processes Uses the same process abstraction

More information

CS 201. Processes. Gerson Robboy Portland State University

CS 201. Processes. Gerson Robboy Portland State University CS 201 Processes Gerson Robboy Portland State University Review Definition: A process is an instance of a running program. One of the most fundamental concepts in computer science. Not the same as program

More information

System Calls & Signals. CS449 Spring 2016

System Calls & Signals. CS449 Spring 2016 System Calls & Signals CS449 Spring 2016 Operating system OS a layer of software interposed between the application program and the hardware Application programs Operating system Processor Main memory

More information

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C. Structure Unix architecture users Functions of the System tools (shell, editors, compilers, ) standard library System call Standard library (printf, fork, ) OS kernel: processes, memory management, file

More information

SE350: Operating Systems

SE350: Operating Systems SE350: Operating Systems Tutorial: The Programming Interface Main Points Creating and managing processes fork, exec, wait Example: implementing a shell Shell A shell is a job control system Allows programmer

More information

Announcement (1) sys.skku.edu is now available

Announcement (1) sys.skku.edu is now available Processes Prof. Jin-Soo Kim( jinsookim@skku.edu) TA JinHong Kim( jinhong.kim@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Announcement (1) sys.skku.edu is now available

More information

This document gives a general overview of the work done by an operating system and gives specific examples from UNIX.

This document gives a general overview of the work done by an operating system and gives specific examples from UNIX. This document gives a general overview of the work done by an operating system and gives specific examples from UNIX. 1 Manages Resources: I/O devices (disk, keyboard, mouse, terminal) Memory Manages Processes:

More information

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu

CPSC 341 OS & Networks. Processes. Dr. Yingwu Zhu CPSC 341 OS & Networks Processes Dr. Yingwu Zhu Process Concept Process a program in execution What is not a process? -- program on a disk A process is an active object, but a program is just a file It

More information

System Programming. Process Control III

System Programming. Process Control III Content : by Dr. B. Boufama School of Computer Science University of Windsor Instructor: Dr. A. Habed adlane@cs.uwindsor.ca http://cs.uwindsor.ca/ adlane/60-256 Content Content 1 Differentiating a process:

More information

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras

Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Introduction to Operating Systems Prof. Chester Rebeiro Department of Computer Science and Engineering Indian Institute of Technology, Madras Week 03 Lecture 12 Create, Execute, and Exit from a Process

More information

Princeton University Computer Science 217: Introduction to Programming Systems. Process Management

Princeton University Computer Science 217: Introduction to Programming Systems. Process Management Princeton University Computer Science 217: Introduction to Programming Systems Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate

More information

Operating Systems. Threads and Signals. Amir Ghavam Winter Winter Amir Ghavam

Operating Systems. Threads and Signals. Amir Ghavam Winter Winter Amir Ghavam 95.300 Operating Systems Threads and Signals Amir Ghavam Winter 2002 1 Traditional Process Child processes created from a parent process using fork Drawbacks Fork is expensive: Memory is copied from a

More information

Lecture 24: Multitasking and Signals

Lecture 24: Multitasking and Signals CSCI-UA.0201-003 Computer Systems Organization Lecture 24: Multitasking and Signals Mohamed Zahran (aka Z) mzahran@cs.nyu.edu http://www.mzahran.com Some slides adapted (and slightly modified) from: Clark

More information

Q & A (1) Where were string literals stored? Virtual Address. SSE2033: System Software Experiment 2 Spring 2016 Jin-Soo Kim

Q & A (1) Where were string literals stored? Virtual Address. SSE2033: System Software Experiment 2 Spring 2016 Jin-Soo Kim Processes Prof. Jin-Soo Kim(jinsookim@skku.edu) TA - Dong-Yun Lee (dylee@csl.skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Q & A (1) Where were string literals stored?

More information

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Processes Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu Processes An instance of a program in execution. One of the most profound ideas in computer

More information

CS 31: Intro to Systems Processes. Kevin Webb Swarthmore College March 31, 2016

CS 31: Intro to Systems Processes. Kevin Webb Swarthmore College March 31, 2016 CS 31: Intro to Systems Processes Kevin Webb Swarthmore College March 31, 2016 Reading Quiz Anatomy of a Process Abstraction of a running program a dynamic program in execution OS keeps track of process

More information

CSC209 Fall Karen Reid 1

CSC209 Fall Karen Reid 1 ' & ) ) #$ "! How user programs interact with the Operating System. Somehow we need to convert a program into machine code (object code). A compiler passes over a whole program before translating it into

More information

Workshop on Inter Process Communication Solutions

Workshop on Inter Process Communication Solutions Solutions 1 Background Threads can share information with each other quite easily (if they belong to the same process), since they share the same memory space. But processes have totally isolated memory

More information

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University

Prepared by Prof. Hui Jiang Process. Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University EECS3221.3 Operating System Fundamentals No.2 Process Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run

More information

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No.

Process. Prepared by Prof. Hui Jiang Dept. of EECS, York Univ. 1. Process in Memory (I) PROCESS. Process. How OS manages CPU usage? No. EECS3221.3 Operating System Fundamentals No.2 Prof. Hui Jiang Dept of Electrical Engineering and Computer Science, York University How OS manages CPU usage? How CPU is used? Users use CPU to run programs

More information

Final Precept: Ish. Slides Originally Prepared by: Wonho Kim

Final Precept: Ish. Slides Originally Prepared by: Wonho Kim Final Precept: Ish Slides Originally Prepared by: Wonho Kim Agenda Last time exec(), fork() wait() Today zombie, orphan process built-in commands in ish I/O redirection Unix signal Process Hierarchy Every

More information

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

Processes. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University Processes Jin-Soo Kim (jinsookim@skku.edu) Computer Systems Laboratory Sungkyunkwan University http://csl.skku.edu OS Internals User space shell ls trap shell ps Kernel space File System Management I/O

More information

Princeton University. Computer Science 217: Introduction to Programming Systems. Process Management

Princeton University. Computer Science 217: Introduction to Programming Systems. Process Management Princeton University Computer Science 217: Introduction to Programming Systems Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate

More information

Fall 2015 COMP Operating Systems. Lab #3

Fall 2015 COMP Operating Systems. Lab #3 Fall 2015 COMP 3511 Operating Systems Lab #3 Outline n Operating System Debugging, Generation and System Boot n Review Questions n Process Control n UNIX fork() and Examples on fork() n exec family: execute

More information

UNIX. Session 2. UNIX processes and forking fork system call exec system call death of process kill fork and I/O using it UNIX.

UNIX. Session 2. UNIX processes and forking fork system call exec system call death of process kill fork and I/O using it UNIX. ProgrammingII Session 2 process handling processes and forking fork system call exec system call death of process kill fork and I/O using it ProgrammingII Short Course Notes Alan Dix 1996 II/20 process:

More information

Advanced Unix/Linux System Program. Instructor: William W.Y. Hsu

Advanced Unix/Linux System Program. Instructor: William W.Y. Hsu Advanced Unix/Linux System Program Instructor: William W.Y. Hsu CONTENTS Process Groups Sessions Signals 5/10/2018 INTRODUCTION TO COMPETITIVE PROGRAMMING 2 Login process 5/10/2018 ADVANCED UNIX/LINUX

More information

Introduction to Processes

Introduction to Processes Computer Systems II Introduction to Processes 1 Review: Basic Computer Hardware CPU Instruction Register Control BUS read (disk) local buffer Disk Controller Memory Executable Disk 1 Review: Timing Problem

More information

Signals. POSIX defines a variety of signal types, each for a particular

Signals. POSIX defines a variety of signal types, each for a particular Signals A signal is a software interrupt delivered to a process. The operating system uses signals to report exceptional situations to an executing program. Some signals report errors such as references

More information

Exceptional Control Flow Part II Nov. 2, 2009"

Exceptional Control Flow Part II Nov. 2, 2009 Exceptional Control Flow Part II Nov. 2, 2009" Unix Startup: Step 2" [0] /etc/inittab Daemons" e.g. ftpd, httpd" init [1] getty init forks and execs daemons per /etc/ inittab, and forks and execs a getty

More information

Recitation Processes, Signals,UNIX error handling

Recitation Processes, Signals,UNIX error handling 15-213 Recitation Processes, Signals,UNIX error handling Section X - TA name 18 March 2019 Bryant and O Hallaron, Computer Systems: A Programmer s Perspective, Third Edition 1 Outline Logistics Process

More information

Processes. CS439: Principles of Computer Systems January 30, 2019

Processes. CS439: Principles of Computer Systems January 30, 2019 Processes CS439: Principles of Computer Systems January 30, 2019 What We Know Operating system complexity increased over time in response to economic and technological changes The three roles did not show

More information

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware

Processes. Operating System CS 217. Supports virtual machines. Provides services: User Process. User Process. OS Kernel. Hardware es CS 217 Operating System Supports virtual machines Promises each process the illusion of having whole machine to itself Provides services: Protection Scheduling Memory management File systems Synchronization

More information

Princeton University. Computer Science 217: Introduction to Programming Systems. Signals

Princeton University. Computer Science 217: Introduction to Programming Systems. Signals Princeton University Computer Science 217: Introduction to Programming Systems Signals 1 Goals of this Lecture Help you learn about: Sending signals Handling signals and thereby How the OS exposes the

More information

Killing Zombies, Working, Sleeping, and Spawning Children

Killing Zombies, Working, Sleeping, and Spawning Children Killing Zombies, Working, Sleeping, and Spawning Children CS 333 Prof. Karavanic (c) 2015 Karen L. Karavanic 1 The Process Model The OS loads program code and starts each job. Then it cleans up afterwards,

More information

Princeton University Computer Science 217: Introduction to Programming Systems. Process Management

Princeton University Computer Science 217: Introduction to Programming Systems. Process Management Princeton University Computer Science 217: Introduction to Programming Systems Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate

More information

Part II Processes and Threads Process Basics

Part II Processes and Threads Process Basics Part II Processes and Threads Process Basics Fall 2017 Program testing can be used to show the presence of bugs, but never to show their absence 1 Edsger W. Dijkstra From Compilation to Execution A compiler

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files ... and systems programming C basic syntax functions arrays structs

More information

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs. CSC209 Review CSC209: Software tools Unix files and directories permissions utilities/commands Shell programming quoting wild cards files... and systems programming C basic syntax functions arrays structs

More information

Processes. CS439: Principles of Computer Systems January 24, 2018

Processes. CS439: Principles of Computer Systems January 24, 2018 Processes CS439: Principles of Computer Systems January 24, 2018 Last Time History Lesson Hardware expensive, humans cheap Hardware cheap, humans expensive Hardware very cheap, humans very expensive Dual-mode

More information

Lecture 4 Threads. (chapter 4)

Lecture 4 Threads. (chapter 4) Bilkent University Department of Computer Engineering CS342 Operating Systems Lecture 4 Threads (chapter 4) Dr. İbrahim Körpeoğlu http://www.cs.bilkent.edu.tr/~korpe 1 References The slides here are adapted/modified

More information

The Kernel. wants to be your friend

The Kernel. wants to be your friend The Kernel wants to be your friend Boxing them in Buggy apps can crash other apps App 1 App 2 App 3 Operating System Reading and writing memory, managing resources, accessing I/O... Buggy apps can crash

More information

fork System-Level Function

fork System-Level Function Princeton University Computer Science 217: Introduction to Programming Systems Process Management Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate Executing

More information

Operating systems and concurrency - B03

Operating systems and concurrency - B03 Operating systems and concurrency - B03 David Kendall Northumbria University David Kendall (Northumbria University) Operating systems and concurrency - B03 1 / 15 Introduction This lecture gives a more

More information

Process Management 1

Process Management 1 Process Management 1 Goals of this Lecture Help you learn about: Creating new processes Waiting for processes to terminate Executing new programs Shell structure Why? Creating new processes and executing

More information

Interacting with Unix

Interacting with Unix Interacting with Unix Synopsis Getting the Process ID #include pid_t getpid(void); Example: #include #include int main(){ pid_t n = getpid(); printf("process id is %d\n",

More information

APPLIED INFORMATICS Processes. Bash characteristics. Command type. Aliases.

APPLIED INFORMATICS Processes. Bash characteristics. Command type. Aliases. Lab 3 APPLIED INFORMATICS Processes. Bash characteristics. Command type. Aliases. Today... /proc /run 1. PROCESSES 2. BASH CHARACTERISTICS 3. COMMAND TYPES 4. ALIASES $$ $PPID pidof ps pgrep kill killall

More information

Operating Systems. Processes. Eno Thereska

Operating Systems. Processes. Eno Thereska Operating Systems Processes Eno Thereska e.thereska@imperial.ac.uk http://www.imperial.ac.uk/computing/current-students/courses/211/ Partly based on slides from Julie McCann and Cristian Cadar Administrativia

More information

Recitation 8 Processes, Signals, Tshlab

Recitation 8 Processes, Signals, Tshlab 15-213 Recitation 8 Processes, Signals, Tshlab 22 October 2018 1 Outline Cachelab Style Process Lifecycle Signal Handling 2 Cachelab Style Grading Style grades will be available "soon" Click on your score

More information

CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes

CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes CS 350 : COMPUTER SYSTEM CONCEPTS SAMPLE TEST 2 (OPERATING SYSTEMS PART) Student s Name: MAXIMUM MARK: 100 Time allowed: 70 minutes Q1 (30 marks) NOTE: Unless otherwise stated, the questions are with reference

More information

Project 2: Shell with History1

Project 2: Shell with History1 Project 2: Shell with History1 See course webpage for due date. Submit deliverables to CourSys: https://courses.cs.sfu.ca/ Late penalty is 10% per calendar day (each 0 to 24 hour period past due). Maximum

More information

CS631 - Advanced Programming in the UNIX Environment. Process Groups, Sessions, Signals

CS631 - Advanced Programming in the UNIX Environment. Process Groups, Sessions, Signals CS631 - Advanced Programming in the UNIX Environment Slide 1 CS631 - Advanced Programming in the UNIX Environment Process Groups, Sessions, Signals Department of Computer Science Stevens Institute of Technology

More information