1 / 12

Process Management Scribe Submission Raghuveer Chanda 11CS10010 20/01/2014

Process Management Scribe Submission Raghuveer Chanda 11CS10010 20/01/2014. Program Process Program vs Process Representation of Process Process Memory Management Program State Process state diagram - Multiprogramming vs Time Sharing Introduction to PCB. Program.

armina
Télécharger la présentation

Process Management Scribe Submission Raghuveer Chanda 11CS10010 20/01/2014

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Process ManagementScribe SubmissionRaghuveer Chanda11CS1001020/01/2014

  2. Program • Process • Program vs Process • Representation of Process • Process Memory Management • Program State • Process state diagram • -Multiprogramming vs Time Sharing • Introduction to PCB

  3. Program • A program is an executable file residing on the disk (secondary storage) in a directory. • Set of instructions stored in the secondary storage device that are intended to carry out a specific job. • It is read into the primary memory and executed by the kernel. • Therefore, it is termed as a ‘passive entity’ which exists in the secondary storage persistently even if the machine reboots. • Few examples: • The ‘Calculator’ program is stored at “:\windows\system32\calc.exe”. • The ‘ls’ program is available at: “/bin/ls”.

  4. Process • An executing instance of a program is called a process. • Some operating systems use the term ‘task‘ to refer to a program that is being executed. • A process is termed as an ‘active entity’ since it is always stored in the main memory and disappears if the machine is power cycled. • On a multiprocessor system, multiple processes can be executed in parallel. • On a uni-processor system, though true parallelism is not achieved, a process scheduling algorithm is applied and the processor is scheduled to execute each process one at a time producing an illusion of concurrency. • Example: Executing multiple instances of the ‘Calculator’ program. • Each of the instances are termed as a process.

  5. Process vs Program • A process is different than a program • Program: Static code and static data • Process: Dynamic instance of code and data • No one-to-one mapping between programs and processes • Can have multiple processes of the same program • Example: many users can run “ls” at the same time • One program can invoke multiple processes • Example: “make” runs many processes to accomplish its work

  6. Representation of Process • Program counter (PC) • Contains the pointer to next instruction to be executed of the process. • Since many process of program can be created each process maintains a stack called process stack • Values of different registers • Stack pointer (SP) (maintains process stack) Return address, Function parameters • Program status word (PSW) C – Carry bit Z-Zero bit O-Overflow bit S-Sign bit I-Interrupt K-Kernel Mode • General purpose registers

  7. Process Memory Management • The text section comprises the compiled program code, read in from non-volatile storage when the program is launched. • The data section stores global and static variables, allocated and initialized prior to executing main. • The heap is used for dynamic memory allocation, and is managed via calls to new, delete, malloc, free, etc. • The stack is used for local variables. Space on the stack is reserved for local variables when they are declared ( at function entrance or elsewhere, depending on the language ), and the space is freed up when the variables go out of scope. The stack is also used for function return values, and the exact mechanisms of stack management may be language specific. • The stack and the heap start at opposite ends of the process's free space and grow towards each other. If they should ever meet, then either a stack overflow error will occur, or else a call to new or malloc will fail due to insufficient memory available.

  8. Process Memory Management

  9. Process State • New - a process being created but not yet included in the pool of executable processes (resource acquisition). • Ready - processes that are prepared to execute when given the opportunity. • Active, Running - the process that is currently being executed by the CPU. • Blocked, Waiting - a process that cannot execute until some event occurs, such as completion of an I/O service or reception of a signal. • Stopped - a special case of blocked where the process is suspended by the user. • Exiting, Terminated - a process that is about to be removed from the pool of executable processes (resource release), a process has finished execution and is no longer a candidate for assignment to a processor, and its remaining resources and attributes are to be disassembled and returned to the operating system's ``free'' resource structures.

  10. Process State Diagram Multi-programming • As a process executes, it changes state • new: The process is being created i.e. It is submitted by an user in job pool. • running: Instructions are being executed by the CPU, the process is in main memory. • waiting: The process is waiting for some event to occur may be I/O. • ready: The process is waiting to be assigned to a processor • terminated: The process has finished its execution and is removed.

  11. Process State Diagram Multi-tasking / time sharing In multi tasking /time sharing systems, interrupt is invoked by the timer after the time slice expires and the process in running state is moved into the ready queue.

  12. Process Control Block (PCB) • All the information related to process must be stored somewhere, so we need a data structure for it. • In OS, all the above discussed properties and attributes are represented by PCB • Some important attributes in PCB are: • Process state • Program counter • CPU registers • CPU scheduling information • Memory-management information • Accounting information • I/O status information

More Related