DOC PREVIEW
UNO CSCI 4500 - The Process Model, Threads, and Interprocess Communication

This preview shows page 1-2-3-4-5 out of 14 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 14 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

1Computer Science 4500Operating SystemsSlide 1Operating SystemsModule 3The Process Model, Threads, and Interprocess CommunicationOperating Systems© 2008 Stanley A. Wileman, Jr.In This Module…The Process ModelProcess StatesThreadsInterrupts, Traps and SignalsInterprocess CommunicationRace ConditionsSolutions to the Mutual Exclusion ProblemSlide 2Operating Systems© 2008 Stanley A. Wileman, Jr.The Process ModelEven in single user systems, more than one potentially unrelated program may need to be active at the same time.This gives the effect of parallel execution of the programs, or pseudoparallelism.A process is the encapsulation of all information about a running program, allowing the CPU to be switched between them.Slide 3Operating Systems© 2008 Stanley A. Wileman, Jr.Why Use Multiple Processes?The advantage of multiple processes is that there are more processes competing for control of the processor(s).co t o o t e p ocesso (s)In general, choose multiple processes whenA significant amount of overlap between the processes can be achieved.The application is too complex to develop as a single process, or would be too complex and difficult to maintain.Slide 4Operating Systems© 2008 Stanley A. Wileman, Jr.Disadvantages of Multiple ProcessesMore processes mean more overhead time and more resource consumption by the operating system This does notthe operating system. This does not directly contribute to the processing needed by the application.Increased programmer effort is needed to coordinate multiple processes and provide for communication between them.Slide 5Operating Systems© 2008 Stanley A. Wileman, Jr.Process and Program TimingIf a CPU is dedicated to running a single program, then that program runs at the full speed of the processor.ppIf multiple processes are running, then the CPU is switched (rapidly) between the processes; each process gets only a fraction of the CPU’s time.Most programs are not time-critical, and so the process model is acceptable.Slide 6Operating Systems© 2008 Stanley A. Wileman, Jr.2Comparing Programs and ProcessesA program is a static set of instructions and data for a processor.Aprocessis the activity of a CPU in carryingA processis the activity of a CPU in carrying out the instructions in a program.Input/output state, quotas, privileges, register contents, and so forth are associated with a process, not a program.Slide 7Operating Systems© 2008 Stanley A. Wileman, Jr.Process HierarchiesA process can create additional processes (using fork or a similar system call).A new process is called a childprocess of the ppparent process that created it.Child processes can create their own child processes to an arbitrary depth (dependent on quotas and other system resources).This results in a tree-structured hierarchy of processes in a system.Slide 8Operating Systems© 2008 Stanley A. Wileman, Jr.System Services, or OS APIsSystem services are those functions provided by the operating system to applications.They are frequently requested (or invoked) yqyq( )using instructions like INT (x86) or SVC (IBM) in assembly language.Most modern operating systems are not written in assembler (but some functions are usually in assembler since high level languages don’t provide the necessary features.Slide 9Operating Systems© 2008 Stanley A. Wileman, Jr.Libraries and Direct System CallsMost high-level languages include libraries of functions for use by applications.Some of these functions make it simpler toSome of these functions make it simpler to invoke system services than by directly invoking them from assembler language.Example: Windows NT includes the CreateProcess system service; the C library includes the spawn function which invokes the CreateProcess system service.Slide 10Operating Systems© 2008 Stanley A. Wileman, Jr.The NT CreateProcess SystemServiceCreateProcess (ImageName, CommandLine,ProcessSecurity, ThreadSecurity,InheritHandlesFlag, CreationFlags,Environment, CurrentDirectory,StartupInfo, ProcessInfo);10 Parameters are needed with this call to create a new process!Slide 11Operating Systems© 2008 Stanley A. Wileman, Jr.The NT _spawnvp Library Function_spawnvp(mode, commandname, argv);mode is _P_WAIT if the parent waits for the child to terminate, orP NOWAITif the parentto terminate, or _P_NOWAITif the parent proceeds in parallel with the child.Commandname is the name of the file containing the executable code, and argv is an array of pointers to parameters.Note that only three arguments are needed here!Slide 12Operating Systems© 2008 Stanley A. Wileman, Jr.3Process StatesDuring their lifetime, processes will always exist in one of three states: running, ready, or blocked.The state of a process is determined by the operating system, and is recorded in its process table entry.Many factors can affect the state of a process, but there are general characteristics of each state.Slide 13Operating Systems© 2008 Stanley A. Wileman, Jr.Process States: RunningRunningA process in the running state is currently being executed by a CPU with all necessary resources required for execution.© 2008 Stanley A. Wileman, Jr. Slide 14Operating SystemsProcess States: ReadyRunningA process in the ready state has all necessary resources required for execution except the CPU.Ready© 2008 Stanley A. Wileman, Jr. Slide 15Operating SystemsProcess States: BlockedRunningA process in the blocked state is not capable of being executed because one or more required resources are unavailable. The process is said to be waitingon a resource, or sleeping.ReadyBlocked© 2008 Stanley A. Wileman, Jr. Slide 16Operating SystemsProcess State SummaryRunning: currently being executed by a CPU with all necessary resources required for execution.Ready: has all necessary resources required for execution except the CPU.Blocked: not capable of being executed because one or more required resources are unavailable. The process is said to be waiting on a resource.Slide 17Operating Systems© 2008 Stanley A. Wileman, Jr.Process State TransitionsProcesses are moved between states by components of the operating system in response to system conditions and process py pactions.There are four transitions of interest:Ready to runningRunning to blockedBlocked to readyRunning to readySlide 18Operating Systems© 2008 Stanley A. Wileman, Jr.4Process State Transitions:Ready to RunningRunningA process is moved from ready to running when a CPU is idle, and the schedulerselects it for execution from the set of


View Full Document

UNO CSCI 4500 - The Process Model, Threads, and Interprocess Communication

Download The Process Model, Threads, and Interprocess Communication
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 The Process Model, Threads, and Interprocess Communication 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 The Process Model, Threads, and Interprocess Communication 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?