Process Management. External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer()

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.
Operating Systems COMP 4850/CISG 5550 Processes Introduction to Threads Dr. James Money.
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.
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 Process Description and Control Chapter 3. 2 Process Management—Fundamental task of an OS The OS is responsible for: Allocation of resources to processes.
Ceng Operating Systems Chapter 2.1 : Processes Process concept Process scheduling Interprocess communication Deadlocks Threads.
MEMORY MANAGEMENT By KUNAL KADAKIA RISHIT SHAH. Memory Memory is a large array of words or bytes, each with its own address. It is a repository of quickly.
Chapter 6 Implementing Processes, Threads, and Resources.
OS Organization. OS Requirements Provide resource abstractions –Process abstraction of CPU/memory use Address space Concurrency Thread abstraction of.
Operating System Organization
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Chapter 6 - Implementing Processes, Threads and Resources Kris Hansen Shelby Davis Jeffery Brass 3/7/05 & 3/9/05 Kris Hansen Shelby Davis Jeffery Brass.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 Operating System Organization.
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3.
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.
Process Description and Control Chapter 3. Major Requirements of an OS Interleave the execution of several processes to maximize processor utilization.
Chapter 8 Windows Outline Programming Windows 2000 System structure Processes and threads in Windows 2000 Memory management The Windows 2000 file.
Threads, Thread management & Resource Management.
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, SMP, and Microkernels Chapter 4. Process Resource ownership - process is allocated a virtual address space to hold the process image Scheduling/execution-
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3.
Mid Term review CSC345.
LINUX System : Lecture 7 Bong-Soo Sohn Lecture notes acknowledgement : The design of UNIX Operating System.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6.
Slide 6-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 6 Implementing Processes, Threads, and Resources 6.
© 2004, D. J. Foreman 1 Implementing Processes and Threads.
1 Threads, SMP, and Microkernels Chapter Multithreading Operating system supports multiple threads of execution within a single process MS-DOS.
Process Description and Control Chapter 3. Source Modified slides from Missouri U. of Science and Tech.
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.
What is an Operating System? Various systems and their pros and cons –E.g. multi-tasking vs. Batch OS definitions –Resource allocator –Control program.
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.
What is a Process ? A program in execution.
Threads, SMP, and Microkernels Chapter 4. Processes and Threads Operating systems use processes for two purposes - Resource allocation and resource ownership.
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 Operating Systems Concepts
Process Management Process Concept Why only the global variables?
Credits: 3 CIE: 50 Marks SEE:100 Marks Lab: Embedded and IOT Lab
Implementing Processes and Threads
Chapter 4 Threads.
Operating Systems: A Modern Perspective, Chapter 6
KERNEL ARCHITECTURE.
Threads and Locks.
Structure of Processes
Threads, SMP, and Microkernels
Mid Term review CSC345.
Lecture Topics: 11/1 General Operating System Concepts Processes
Lecture 4- Threads, SMP, and Microkernels
Threads Chapter 4.
Threads Chapter 5 2/17/2019 B.Ramamurthy.
Operating Systems Lecture 1.
Threads Chapter 5 2/23/2019 B.Ramamurthy.
LINUX System : Lecture 7 Lecture notes acknowledgement : The design of UNIX Operating System.
Operating Systems: A Modern Perspective, Chapter 3
Operating Systems: A Modern Perspective, Chapter 6
Implementing Processes and Threads
Implementing Processes, Threads, and Resources
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Outline Operating System Organization Operating System Examples
Process Description and Control in Unix
Outline Process Management Process manager Hardware process
Implementing Processes, Threads, and Resources
Presentation transcript:

Process Management

External View of the OS Hardware fork() CreateProcess() CreateThread() close() CloseHandle() sleep() semctl() signal() SetWaitableTimer() wait() WaitForSingleObject() C Program C Program OS Process Mgr Memory Mgr Device Mgr File Mgr

Process Management Responsibilities Define & implement the essential characteristics of a process and thread –Algorithms to define the behavior –Data structures to preserve the state of the execution Define what “things” threads in the process can reference – the address space (most of the “things” are memory locations) Manage the resources used by the processes/threads Tools to create/destroy/manipulate processes & threads Tools to time-multiplex the CPU – Scheduling the (Chapter 7) Tools to allow threads to synchronization the operation with one another (Chapters 8-9) Mechanisms to handle deadlock (Chapter 10)

Initializing the Machine Power up  fetch-execute cycle begins Initial (or hardware) process begins to run Executes ROM diagnostic program Then bootstrap loads the OS OS initialization –Setup & initialize all system data structures (this creates process & resource abstractions) –Initialize all devices –Start daemons – including idle process –Branches to the scheduler

Process Abstraction Layers Control Unit P i Address Space P i Address Space P j Address Space P j Address Space P k Address Space P k Address Space Hardware process (OS) coroutines across p i, p j, and p k under OS control P i Control Unit P j Control Unit P k Control Unit p i, p j, and p k each have their own virtual machine OS interface P i Virt Term P j Virt Term P k Virt Term p i, p j, and p k each have their own virtual terminal Window Mgr interface OS Address Space OS Address Space Process Mgr

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 Process Mgr

System Call Interface Unix Organization 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

NT Organization Processor(s)Main MemoryDevices Libraries Process Subsystem User Supervisor Subsystem Hardware Abstraction Layer NT Kernel NT Executive I/O Subsystem T T T T T T TT T

Process Descriptor OS creates/manages process abstraction Descriptor is data structure for each process –Register values –Logical state –Type & location of resources it holds –List of resources it needs –Security keys –etc. (see Table 6.1 and the source code of your favorite OS)

Creating a Process in UNIX pid = fork(); UNIX kernel … Process Table Process Descriptor

Creating a Process in NT CreateProcess(…); Win32 Subsystem ntCreateProcess(…); … ntCreateThread(…); NT Executive NT Kernel … Handle Table Process Descriptor

Handles

NT Process Descriptor

 Kernel process object including:  Pointer to the page directory  Kernel & user time  Process base priority  Process state  List of the Kernel thread descriptors that are using this process

NT Process Descriptor (cont)  Parent identification  Exit status  Creation and termination times.  Memory status  Security information  executable image  Process priority class used by the thread scheduler.  A list of handles used by this process  A pointer to Win32-specific information

Resource Model R = {R j | 0  j < m} = resource types C = {c j  0 |  R j  R (0  j < m)} = units of R j available Reusable resource: After a unit of the resource has been allocated, it must ultimately be released back to the system. E.g., CPU, primary memory, disk space, … The maximum value for c j is the number of units of that resource Consumable resource: There is no need to release a resource after it has been acquired. E.g., a message, input data, … Notice that c j is unbounded. Resource: Anything that a process can request, then be blocked because that thing is not available.

Using the Model There is a resource manager, Mgr(R j ) for every R j Mgr(R j ) p i can only request n i  c j units of reusable R j p i can request unbounded # of units of consumable R j Process p i can request units of R j if it is currently running Process request Mgr(R j ) can allocate units of R j to p i allocate release p i can release units of R j that it holds (reusable) or produces (consumable)

Resource Manager Design Mgr(R j ) Process Resource Pool releaserequest allocate release

Address Space Process Address Space Primary Memory Primary Memory Mailboxes System services Other objects Files

Defining the Address Space Some parts are built into the environment –Files –System services Some parts are imported at runtime –Mailboxes –Network connections Memory addresses are created at compile (and run) time

The Compile Time Component Source Modules Translator Relocatable Modules Link Editor Absolute Program Loader Executable Program Primary Memory

Processes &Threads Address Space Map Stack State Program Static data Resources Stack State Map

Process State (Version 1) Ready Blocked Running Start Schedule Request Done Request Allocate

Process State (UNIX) Runnable Uninterruptible Sleep Running Start Schedule Request Done I/O Request Allocate zombie Wait by parent Sleeping Traced or Stopped Request I/O Complete Resume

Process Hierarchies Parent-child relationship may be significant: parent controls children’s execution Ready-Active Blocked-Active Running Start Schedule Request Done Request Allocate Ready-Suspended Blocked-Suspended Suspend Yield Allocate Suspend Activate