Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 3 Operating System Organization.
Slide 2-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 2 Using the Operating System 2.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
Threads, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6 Implementing Processes, Threads, and Resources.
Processes CSCI 444/544 Operating Systems Fall 2008.
Figure 2.8 Compiler phases Compiling. Figure 2.9 Object module Linking.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Introduction to Kernel
1 Process Description and Control Chapter 3. 2 Process Management—Fundamental task of an OS The OS is responsible for: Allocation of resources to processes.
Home: Phones OFF Please Unix Kernel Parminder Singh Kang Home:
CSCE 351: Operating System Kernels
Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()
Advanced OS Chapter 3p2 Sections 3.4 / 3.5. Interrupts These enable software to respond to signals from hardware. The set of instructions to be executed.
Chapter 2 Processes and Threads Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved
Chapter 6 Implementing Processes, Threads, and Resources.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Process Description and Control A process is sometimes called a task, it is a program in execution.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
Chapter 51 Threads Chapter 5. 2 Process Characteristics  Concept of Process has two facets.  A Process is: A Unit of resource ownership:  a virtual.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
System Calls 1.
Protection and the Kernel: Mode, Space, and Context.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
CSC 501 Lecture 2: Processes. Process Process is a running program a program in execution an “instantiation” of a program Program is a bunch of instructions.
Threads, Thread management & Resource Management.
Chapter 3 Process Description and Control
The Structure of Processes (Chap 6 in the book “The Design of the UNIX Operating System”)
Lecture 3 Process Concepts. What is a Process? A process is the dynamic execution context of an executing program. Several processes may run concurrently,
Threads G.Anuradha (Reference : William Stallings)
Processes Introduction to Operating Systems: Module 3.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6 Implementing Processes, Threads, and Resources 6.
Chapter 2 Processes and Threads Introduction 2.2 Processes A Process is the execution of a Program More specifically… – A process is a program.
Processes CS 6560: Operating Systems Design. 2 Von Neuman Model Both text (program) and data reside in memory Execution cycle Fetch instruction Decode.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
Processes and Virtual Memory
Threads, Thread management & Resource Management.
Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry.
2 Processor(s)Main MemoryDevices Process, Thread & Resource Manager Memory Manager Device Manager File Manager.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
1 Structure of Processes Chapter 6 Process State and Transition Data Structure for Process Layout of System Memory THE DESIGN OF THE UNIX OPERATING SYSTEM.
CS4315A. Berrached:CMS:UHD1 Operating Systems and Computer Organization Chapter 4.
1 Process Description and Control Chapter 3. 2 Process A program in execution An instance of a program running on a computer The entity that can be assigned.
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
What is a Process ? A program in execution.
CSCI/CMPE 4334 Operating Systems Review: Exam 1 1.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
WORKING OF SCHEDULER IN OS
Introduction to Operating Systems Concepts
Introduction to Kernel
Processes and threads.
Process concept.
Structure of Processes
Protection of System Resources
Operating Systems: A Modern Perspective, Chapter 6
Intro to Processes CSSE 332 Operating Systems
Structure of Processes
More examples How many processes does this piece of code create?
Process Description and Control
Lecture Topics: 11/1 General Operating System Concepts Processes
Process Description and Control
Lecture 6: Multiprogramming and Context Switching
Operating Systems: A Modern Perspective, Chapter 6
Implementing Processes, Threads, and Resources
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
CS510 Operating System Foundations
Outline Process Management Process manager Hardware process
Implementing Processes, Threads, and Resources
Structure of Processes
Presentation transcript:

Hardware process When the computer is powered up, it begins to execute fetch-execute cycle for the program that is stored in memory at the boot strap entry point Hardware process is just a name to represent the iterative activity of the control unit, as it fetches and execute instructions. Operating Systems: A Modern Perspective, Chapter 6

Fetch execute algorithm PC = ; IR = memory[PC]; haltFlag = CLEAR; while(haltFlag not SET) { execute(IR); PC = PC + sizeof(INSTRUCT); IR = memory[PC]; // fetch phase }

Algorithms, Programs, and Processes Data Files Other Resources Algorithm Idea Source Program Source Program Binary Program Execution Engine Process Stack Status

Operating Systems: A Modern Perspective, Chapter 6 Process Manager Overview Program Process Abstract Computing Environment File Manager Memory Manager Device Manager Protection Deadlock Synchronization Process Description Process Description CPU Other H/W Scheduler Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Memory Devices

Operating Systems: A Modern Perspective, Chapter 6 UNIX Organization System Call Interface File Manager Memory Manager Device Manager Protection Deadlock Synchronization Process Description Process Description CPU Other H/W Scheduler Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Resource Manager Memory Devices Libraries Process Monolithic Kernel

Process manager responsibilities Process creation and termination Thread creation and termination Resource allocation Protection & security Implementing address space Providing mechanisms for process synchronization Providing mechanisms for process communication Providing mechanisms for deadlock handling Operating Systems: A Modern Perspective, Chapter 6

(a) Multiprogramming of four programs. (b) Conceptual model of four independent, sequential processes. (c) Only one program is active at once. Multiprogramming Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved

Operating Systems: A Modern Perspective, Chapter 6 Tracing the Hardware Process Bootstap Loader Process Manager Interrupt Handler P1P1 P,2 PnPn … Machine is Powered up Initialization Load the kernel Service an interrupt Hardware process progress Execute a thread Schedule

Process management Operating Systems: A Modern Perspective, Chapter 6 The process manager creates the environment in which multiple processes co-exist, each with own abstract machine When hardware process begin to execute OS code, it will execute an algorithm that switches the hardware process from one context to another These Context switches can occur when ever OS gets control of the processor.

Processes A process is the execution of a program A process is consists of text (machine code), data and stack Many process can run simultaneously as kernel schedules them for execution Several processes may be instances of one program A process reads and writes its data and stack sections, but it cannot read or write the data and stack of other processes A process communicates with other processes and the rest of the world via system calls

Processes Kernel has a process table that keeps tract of all active processes Each entry in the process table contains pointers to the text, data, stack and the U Area of a process. All processes in UNIX system, except the very first process (process 0) which is created by the system boot code, are created by the fork system call

When a process is created, the process manager algorithm creates a data structure to keep all the details it requires for managing the process. The process descriptor is the data structure where the OS will keep all information it needs to manage that process. What information should be kept in a process descriptor ? Operating Systems: A Modern Perspective, Chapter 6

Some of the fields of a typical process table entry Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall, Inc. All rights reserved

Process descriptor Process idInternal name of the process stateProcess’s current state ownerProcess owner. threadsList of threads associated with this process List of related processList of sibling process List of child processA reference to list of child of this process Address spaceA description of the address space and its binding stackLocation of the stack in the memory Operating Systems: A Modern Perspective, Chapter 6

Linux Process Descriptor

Kernel Support for Process Text Stack Data File Descriptor Table Per Process Region Table Kernel Process Table Kernel Region Table A Process U Area

Process: Region Table Region table entries describes the attributes of the region, such as whether it contains text or data, whether it is shared or private The extra level from the per process region table to kernel region table allows independent processes to share regions.

Process: U Area U Area is the extension of process table entry. Fields of process table entry: – State field – User ID (UID) Fields of U Area – Pointer to process table entry – File descriptors of all open files – Current directory and current root – I/O parameters – Process and file size limit Kernel can directly access fields of the U Area of the executing process but not of the U Area of other processes

Process context The context of a process consists of the contents of its (user) address space and the contents of hardware registers and kernel data structures that relate to the process. Formally, the context of a process is the union of its user-level context ; register context, and system -level context. The user-level context consists of the process – text, data, user stack, and shared memory that occupy the virtual address space of the process.

Register context The register context consists of the following component The program counter specifies the address of the next instruction the CPU willexecute; The processor status register (PS) specifies the hardware status of the machine as it relates to the process. The stack pointer contains the current address of the next entry in the kernel or user stack, determined by the mode of execution. The general-purpose registers contain data generated by the process during its execution.

System level context The system-level context of a process has a "static part and a "dynamic part“. A process has one static part of the system- level context throughout its lifetime, but it can have a variable number of dynamic parts. The process table entry of a process The u area of a process Per region entries, region tables and page tables, define the mapping from virtual to physical addresses The kernel stack which contains the stack frames of kernel procedures. The dynamic part of the system-level context of a process consists of a set of layers, visualized as a last-in-first out stack. Each system -level context layer contains the necessary information to recover the previous layer, including the register context of the previous level.

Context Switch When the kernel decides that it should execute another process, it does a context switch, so that the system executes in the context of the other process When doing a context switch, the kernel saves enough information so that it can later switch back to the first process and resume its execution. the kernel saves the context of a process whenever it pushes a new system context layer.

Operating Systems: A Modern Perspective, Chapter 6 Context Switching Process Manager Interrupt Handler P1P1 P2P2 PnPn Executable Memory Initialization Interrupt 8 9 6

Mode of Process Execution The UNIX process runs in two modes: – User mode Can access its own instructions and data, but not kernel instruction and data – Kernel mode Can access kernel and user instructions and data When a process executes a system call, the execution mode of the process changes from user mode to kernel mode

Mode of Process Execution When moving from user to kernel mode, the kernel saves enough information so that it can later return to user mode and continue execution from where it left off. Mode change is not a context switch, just change in mode.

Operating Systems: A Modern Perspective, Chapter 6 State of a Process State Variable - summary status of the process/thread which is located in descriptor Ready Blocked Running Start Schedule Request Done Request Allocate Simple State Diagram