Chico CSCI 340 - Chapter 3.2: Processes modified by your instructor

Unformatted text preview:

Chapter 3.2: Processes modified by your instructorChapter 3: ProcessesOperations on ProcessesProcess ManagementProcess Creation (different source)Slide 6Slide 7Process Creation (text)Process Creation (Cont.)C Program Forking Separate ProcessProcess CreationProcess TerminationCooperating ProcessesShared Memory; Message PassingCooperating Processes – Shared MemoryShared Memory – buffering options…Bounded-Buffer – Shared-Memory SolutionBounded-Buffer – Insert() MethodBounded Buffer – Remove() MethodInterprocess Communication (IPC) Message-Passing SystemsSlide 21Implementation QuestionsDirect CommunicationDirect Communication Symmetric / Asymmetric addressingIndirect CommunicationIndirect Communication (right from the Textbook here)Indirect Communications - MailboxesSynchronizationSynchronization – Blocking and UnblockingBufferingClient-Server CommunicationSocketsSocket CommunicationSlide 34Slide 35Lastly on SocketsRemote Procedure CallsRPC – moreRPC – Semantics – Issue 1RPC – Semantics – Issue 2RPC – Semantics – Issue 2 continuedRPC – lastlyRemote Method InvocationSlide 44Marshalling ParametersRMI – lastEnd of Chapter 3Chapter 3.2: ProcessesChapter 3.2: Processesmodified by your instructormodified by your instructor3.2Silberschatz, Galvin and Gagne ©2005Operating System ConceptsChapter 3: ProcessesChapter 3: ProcessesProcess ConceptProcess SchedulingOperations on ProcessesCooperating ProcessesInterprocess CommunicationCommunication in Client-Server SystemsThis is a very important chapter now that we have completed the introductory materials.This will require two to three lectures.3.3Silberschatz, Galvin and Gagne ©2005Operating System ConceptsOperations on ProcessesOperations on Processes3.4Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess ManagementProcess ManagementA UNIX process is a unique instance of a running or runnable program.Every process in a UNIX system has the following attributes:Some code (text)Some dataA stackA unique process ID (PID) number (usually an integer)Processes may be created / terminated dynamically and run concurrently. (dynamically means? Concurrently means?)Creating parent is called parent; new processes: children.Hence, a tree of processes can be created.3.5Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess Creation (Process Creation (different sourcedifferent source))In Solaris, the top process pid = 0 and is Sched (the Scheduler process).Sched ‘creates’ several processes including init – serves as root process for all user processesInit is also the only visible process in the system at startup.pageout and Fsflush (stands for file system flush)Last two responsible for managing memory and file system.Only way to create a new process is to duplicate an existing process.When a process duplicates, the parent and child processes are virtually identical except for PIDs, PPIDs, and run times.The child’s code and stack are a copy of the parent’s and it even continues to execute the same code.A child process may, however, in certain instances replace its code with that of another executable file.This makes it somewhat different than its parent, but its dependency still holds.For example, when ‘init’ starts executing, it quickly duplicates several times. Hierarchy looks like:3.6Silberschatz, Galvin and Gagne ©2005Operating System Concepts Parent init (PID 1) Child getty (PID 4)handle a login Child getty (PID 5) handle a login Child getty (PID)handle a loginWhen a child terminates, this is communicated to the parent•parent can take appropriate action •common for parent process to suspend until one of its children terminates.Example: When a shell executes a utility in the foreground, it duplicates into two shell processes: • the child shell process is ‘spawned’ and replaces its code with that of the utility,• the parent shell waits for the child process to terminate (then continues..). When the child process terminates, the original parent process is awakened.See next slide. This also includes the required system calls as well.3.7Silberschatz, Galvin and Gagne ©2005Operating System ConceptsParent Process PID 34Running shellParent Process PID 34 running shell waiting for childChild Process PID 35 running shellDuplicate: fork()Differentiate: exec()Child Process PID 35 running some utilityChild Process PID 35 terminatesTerminate: exit () Wait for child: wait() Parent Process PID 34 running shell, awakensSignalSystem calls: fork() – duplicates a process; exit() – terminates a process; wait() – waits for a child process; exec() – replaces the code data and stack of a process(Can get a complete listing of processes by using the ps -el command.)3.8Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess Creation (text)Process Creation (text)Thus, parent processes create children processes, which, in turn create other processes. A large tree of processes can result. All processes need resources (CPU, memory, files, I/O devices…) This implies need for resource sharingChild processes may get resources from the operating system, May share some resources (e.g. memory, files) or Parent may need to ‘partition’ its resources among its children.Sharing / partitioning resources prevents overloading the system by creating many processes.Needed parameters may also be passed from parent to child Example in book: process to display a file: img.jpg on a screenParent needs to pass name of the file (needed to open / write file) and name of the output device.OS might pass the resources (alternatively) to the child process directly.Here, the child just transfers the data between the two open files.3.9Silberschatz, Galvin and Gagne ©2005Operating System ConceptsProcess Creation (Cont.)Process Creation (Cont.)Execution – two possibilities.Parent and children execute concurrently, orParent waits until some / all children terminateAddress space – two possibilities here too.Child is duplicate of parent (has same program and data as parent) orChild has a new program loaded into itTo illustrate: consider a UNIX examplefork() system call creates new processexec() system call used after a fork() to replace the process’ memory space with a new


View Full Document

Chico CSCI 340 - Chapter 3.2: Processes modified by your instructor

Download Chapter 3.2: Processes modified by your instructor
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Chapter 3.2: Processes modified by your instructor and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Chapter 3.2: Processes modified by your instructor 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?