
Mohammad S. Hasan Faculty of Computing, Engineering & Technology Windows – Object manager and process management Mohammad S. Hasan Staffordshire University, UK Windows – Object manager and process management Slide 1 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Lecture Outline Windows object management Threads and processes in Windows Thread priority and scheduling Thread synchronisation Inter-process communication Internal process and thread representation Windows – Object manager and process management Slide 2 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Windows structure overview User Application Subsystem DLL Environment Subsystem System Support System Services NTdll.DLL User Mode Kernel Mode Executive API / Executive Services I/O Cache Process and Security Virtual Win32 User Manager Manager Thread Manager Reference Memory and GDI Monitor Manager (Graphics Plug & Play Power Manager Configuration Engine) File Manager Manager System Object Manager / Local Procedure Call Graphics Drivers Device Drivers Kernel Hardware Abstraction Layer (HAL) Windows – Object manager and process management Slide 3 Mohammad S. Hasan Faculty of Computing, Engineering & Technology System resources and data The OS needs to keep track The OS keeps track of all of all the different processes (running resources programs) Files To do this the OS needs to I/O devices keep info about these resources and their use. Memory CPU usage Windows – Object manager and process management Slide 4 Mohammad S. Hasan Faculty of Computing, Engineering & Technology System resources and data (Cont.) In many OS the info is maintained in various data structures which the operating system code manipulates In Windows the code that manipulates the data is kept together with the data in objects i.e. it uses an object oriented approach to manage the system resources and info about them Windows – Object manager and process management Slide 5 Mohammad S. Hasan Faculty of Computing, Engineering & Technology System resources and data (Cont.) ALL entities and services on the system are represented internally by objects e.g. files are represented by objects, user programs when they are running on the computer, hardware resources like printers, communication ports, etc. Motivation behind this is to provide a very modular structure which it is easy to update, extend, etc. Windows – Object manager and process management Slide 6 Mohammad S. Hasan Faculty of Computing, Engineering & Technology System resources and data (Cont.) Abstraction i.e. hiding details of implementation of the object’s class changes to internal implementation of an object's class can occur without affecting the code implementation of other object classes provided the interface remains unchanged It also makes it easier to add new features and facilities to the system in the form of new object classes Windows – Object manager and process management Slide 7 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Object Manager The function of the object manager is to provide services that manage all the objects in the system Various other components in the Windows Executive and the Environmental Subsystems can create, use, and destroy objects using Object Manager Object Manager / Local Procedure Call Graphics Drivers Device Drivers Kernel Hardware Abstraction Layer (HAL) Windows – Object manager and process management Slide 8 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Object manager (Cont.) Object manager provides a uniform set of services to the other components of the Executive - thus it simplifies object access Windows – Object manager and process management Slide 9 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Object Handles and Handle Table When a process wants to use an object it calls the object manager to get a handle to that object handles are like pointers in C that allow you to access the methods and data of an object Processes must have an object handle for every resource/item that it uses e.g. files, I/O devices, etc. Windows – Object manager and process management Slide 10 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Object Handles and Handle Table (Cont.) Each process has an Object Handle Table that contains Process all the handles to the various objects that the process has opened Windows – Object manager and process management Slide 11 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Object structure An object in the Object Object name system has Header Object directory Security descriptor List of processes object header with handles Quotas object body Open handle count to object Open handle list Type Object type Object Object Body Object specific data Windows – Object manager and process management Slide 12 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Object structure (Cont.) Object header contains information such as the object's name, the hierarchy to which it belongs, security information (we will discuss that in more detail later), quota information, number of handles opened on object, pointer to a list of processes that have handles opened on object, pointer to an object that contains information about the object's type Windows – Object manager and process management Slide 13 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Object structure (Cont.) Object body contains information that is specific to the object Type object contains information that is common to all objects of a particular type (class) includes the code for all the methods that belong to the object class Windows – Object manager and process management Slide 14 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Object services The object manager provides a set of services that are common to all objects: create - creates object and returns a handle to it open - returns an object handle to calling process close - destroys handle delete - deletes object duplicate handle query information held in object Windows – Object manager and process management Slide 15 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Processes and threads In Windows a process consists of program code, execution context (the address space of the process plus such things as the access token), resources allocated to the process i.e. handles, and one or more threads Threads are the units of execution – they execute program code using the processes context and resources Windows – Object manager and process management Slide 16 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Processes and threads (Cont.) A thread has its own context i.e. register values including instruction pointer, execution stack, and scheduling priority etc. Threads are scheduled onto the processor, not a process. this is different from Linux which for scheduling purposes treats threads as a separate process that happens to share address space with another thread Windows – Object manager and process management Slide 17 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Processes and threads (Cont.) Processes and threads are managed by 2 components in Windows: the process and thread manager the kernel Windows – Object manager and process management Slide 18 Mohammad S. Hasan Faculty of Computing, Engineering & Technology The Kernel The kernel is responsible for: Thread scheduling Interrupt and exception handling Low level processor synchronisation Recovery after power failure Windows – Object manager and process management Slide 19 Mohammad S. Hasan Faculty of Computing, Engineering & Technology The Kernel (Cont.) In normal OS, the kernel refers to all the operating systems components that run in kernel mode. In Windows, this applies to all the Windows Executive components (everything below the line in the diagram – slide 3). However, Windows applies the name kernel to just one component – a low level layer of the OS that manages much of the execution of threads within processes Windows – Object manager and process management Slide 20 Mohammad S. Hasan Faculty of Computing, Engineering & Technology The Kernel (Cont.) The kernel uses objects to represent and manage low level threads and processes Object Manager However these kernel objects are (High Level Object) different from those managed by the Object Manager They are lower level and provide support for the higher level objects Kernel used by the Object Manager (Low Level Object) Windows – Object manager and process management Slide 21 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Process and thread manager Process manager is part of the Windows Executive. implements the representation of processes and threads that are available to other parts of the Executive and provides high level services to manage and control processes and threads Windows – Object manager and process management Slide 22 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Process and thread manager (Cont.) Process and thread manager provides functions to Create and destroy processes Control resource allocation to processes Keep track of information about processes and threads Processes are created by other processes by making a CreateProcess system call Windows – Object manager and process management Slide 23 Mohammad S. Hasan Faculty of Computing, Engineering & Technology Process and thread manager (Cont.) Unlike Unix/Linux, the parent and child process are independent of each other. remember fork in Unix/Linux creates
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages40 Page
-
File Size-