What is a Process ? A program in execution.

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

Chapter 3 Process Description and Control
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.
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 2. Page 2 Processes The Process Model Multiprogramming of four programs Conceptual model of 4 independent, sequential.
Page 1 Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
1 CS 333 Introduction to Operating Systems Class 2 – OS-Related Hardware & Software The Process Concept Jonathan Walpole Computer Science Portland State.
Introduction to Kernel
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 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.
Processes Part I Processes & Threads* *Referred to slides by Dr. Sanjeev Setia at George Mason University Chapter 3.
CSE 451: Operating Systems Autumn 2013 Module 6 Review of Processes, Kernel Threads, User-Level Threads Ed Lazowska 570 Allen.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
Protection and the Kernel: Mode, Space, and Context.
OPERATING SYSTEM OVERVIEW. Contents Basic hardware elements.
CSC 322 Operating Systems Concepts Lecture - 4: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
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. What is a Process? an instance of running program Program vs process(task) Program : just a passive collection of instructions.
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,
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.
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.
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING SUSE Lab.
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.
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.
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,
Introduction to Kernel
Processes and threads.
Structure of Processes
Protection of System Resources
Operating Systems: A Modern Perspective, Chapter 6
Structure of Processes
More examples How many processes does this piece of code create?
Process Description and Control
Process Description and Control
Threads Chapter 4.
Process Control B.Ramamurthy 2/22/2019 B.Ramamurthy.
Process Description and Control
Lecture 6: Multiprogramming and Context Switching
Unix Process Control B.Ramamurthy 4/11/2019 B.Ramamurthy.
Implementing Processes, Threads, and Resources
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
CS510 Operating System Foundations
Process Description and Control in Unix
Outline Process Management Process manager Hardware process
Process Description and Control in Unix
Implementing Processes, Threads, and Resources
Structure of Processes
Presentation transcript:

What is a Process ? A program in execution. A process includes program's instructions and data, program counter and all CPU's registers, process stacks containing temporary data. Each individual process runs in its own virtual address space and is not capable of interacting with another process except through secure, kernel managed mechanisms.

process The process is one of the fundamental abstraction in Linux operating system Processes provide two virtualizations: a virtualized processor and virtual memory

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

C memory layout

Process Address Space

Process Creation and Execution UNX process management separates the creation of processes and the running of a new program into two distinct operations. The fork system call creates a new process. A new program is run after a call to execv.

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

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

Process manager

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

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

Process management 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. Operating Systems: A Modern Perspective, Chapter 6

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

A Process’s Virtual Memory task_struct vm_area_struct mm_struct mm vm_end vm_start vm_flags vm_inode vm_ops vm_next count pgd mmap mmap_avl mmap_sem data vm_area_struct vm_end vm_start vm_flags vm_inode vm_ops vm_next code

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.

Per process region table: pregion Several process can share a region Kernel contains a region table and allocates an entry from the table for each active region in the system Each process contain a pregion

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 will execute; 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.

A Process’s Virtual Memory task_struct vm_area_struct mm_struct mm vm_end vm_start vm_flags vm_inode vm_ops vm_next count pgd mmap mmap_avl mmap_sem data vm_area_struct vm_end vm_start vm_flags vm_inode vm_ops vm_next code

Context Switching Executable Memory Initialization Process Manager 1 Process Manager 9 6 4 2 8 5 3 7 Interrupt Interrupt Handler P1 P2 Context switch can take place when OS gets control of processor ABOVE: first nine context switches Process manager performs all the context switching Pn Operating Systems: A Modern Perspective, Chapter 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.

State of a Process State Variable - summary status of the process/thread which is located in descriptor Simple State Diagram Request Done Running Request Schedule Transitions from one state to another Running - request -> either get resource & continue running or not get resource & block Start Allocate Blocked Ready Operating Systems: A Modern Perspective, Chapter 6

Process State stopped creation signal signal termination executing zombie ready scheduling input / output suspended end of input / output

Process Relationship parent oldest youngest child child child p_pptr p_opptr p_pptr p_opptr p_cptr p_pptr p_opptr p_osptr p_osptr oldest child youngest child child p_ysptr p_ysptr