1 / 20

Characteristics of operating systems

Characteristics of operating systems. What is a program? A program is an inactive unit such as a file stored on a disk. A unit of work submitted by a user. What is a process? A program in execution

teleri
Télécharger la présentation

Characteristics of operating systems

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. Characteristics of operating systems

  2. What is a program? • A program is an inactive unit such as a file stored on a disk. • A unit of work submitted by a user. What is a process? • A program in execution • For example, when you double-click the Microsoft Word icon, you start a process that runs Word. • Every process contains a program code and the existing activity • A process consume considerable amounts of memory. Therefore, they are greatly dependent on the resources available for execution. Hence, a process is known to be a “heavyweight process”. • If there are more processes present, the switching between each process is heavily expensive as it will take time from each memory allocation to switch to another allocation. • Each process has its own address space which consists of a text region, data region and stack region. • A process is independent of other processes. So, when a parent process is modified it won’t necessarily affect other processes. • Processes require inter-process communication (IPC) so they can communicate with their siblings.

  3. admitted new terminated Process State exit interrupt ready running Dispatch I/O or event wait waiting I/O or event completion Fig. 1 Diagram of process state

  4. The state of a process is defined in part by the current activity of that process. • Each process might be in one of the following states: • New: the process is being created • Running: instructions are being executed • Waiting: process is waiting for some event to occur (such as an I/O completion) • Ready: process is waiting to be assigned to a processor • Terminated: process has finished execution

  5. WHY do process make transitions between states? • Process that are in the READY, RUNNING and WAITING states are actively contending for processor time, hence the operating system manages state transitions to best serve processes in the system. • To prevent any one process from monopolizing the system, either accidentally or maliciously, by setting a hardware interrupting clock to allow a process to run for a specific time interval.

  6. Process States & State Transitions • HOW do process make transitions between states? • When a user runs a program, the system create a NEW process and placed it in a queue. • From NEW state, the process moves to READY state when it’s ready to run but waiting for the CPU. In some systems, the process might be placed on the READY list directly. • When a processor becomes available, the process is given a processor and is said to make a state transition from the READY state to the RUNNING state. The act of assigning a processor to the first process on the queue is called dispatching. • If the process does not voluntarily give forth the processor before the time interval expires, the interrupting clock generates an interrupt, and the OS will gain control of the processor. • The OS will then change the state of the previous RUNNING process to READY and dispatches the first process on the ready list, changing its state from READY to RUNNING.

  7. If a RUNNING process initiates an I/O operation before its interval expires and must wait for the I/O operation to complete before it can use a processor again, the RUNNING process voluntarily relinquishes the processor. In this case the process is changed into WAITING state, pending the completion of the I/O operation. • Processes in the WAITING state cannot execute even if a processor becomes available. When an I/O operation or some other event the process is waiting completes, the OS changes the process from WAITING to READY. • Upon completion, a process is TERMINATED and returned to the user.

  8. Process Control Block (PCB) • Each process in the system is represented by a data structure called a Process Control Block (PCB) that performs the same function as a traveler’s passport. • PCB is also known as process descriptor. • The PCB contains the basic information about the job including what it is, where it’s going, how much of its processing has been completed, where it’s stored and how much it has spent in using resources. Process Identification Process Status Process State: Process Status Word Register Contents Main Memory Resources Process Priority Accounting

  9. PROCESS IDENTIFICATION Each job is uniquely identified by the user’s identification and a pointer connecting it to its descriptor. • PROCESS STATUS Indicates the current status of the job – NEW, READY, RUNNING, WAITING, TERMINATED – and the resources responsible for that status. • PROCESS STATE Contains all the information needed to indicate the current state of the job, such as: • Process Status Word the current instruction counter and register contents when the job isn’t running but either is on HOLD or is READY or WAITING. If the job is RUNNING, this information is left undefined. • Register Contents the contents of the register if the job has been interrupted and is waiting to resume processing.

  10. Main Memory important information including the address where the job is stored, and in the case of virtual memory, the mapping between virtual and physical memory locations. • Resources information about all resources allocated to this job. Each job has an ID field listing its type and a field describing details of its allocation such as the sector address on a disk. The resources can be hardware units or files. • Process Priority Used by systems using apriority scheduling algorithm to select which job will be run next.

  11. ACCOUNTING Contains information used mainly for billing purposes and performance measurement. It indicates what kind of resources the job used and for how long. Typical charges include: • Amount of CPU time used from beginning to end of its execution • Total time the job was in the system until it exited • Main storage occupancy – how long the job stayed in memory until it finished execution • Secondary storage used during execution • System programs used such as compilers, editors or utilities • Number and type of I/O operations, including I/O transmission time, utilization of channels, control units and devices • Time spent waiting for I/O completion • Number of input records read and output records written. This last one distinguishes between secondary storage devices and typical I/O devices.

  12. PCBs and Queuing • A job’s PCB is created when the system accepts the job and is updated ad the job progresses from beginning to the end of its execution. • Queues use PCBs to track jobs the same way customs officials use passports to track international visitors. The PCB contains all the data about the job needed by the operating system to manage the processing of the job. • The PCBs, not the jobs, are linked to form queues as shown in the Figure next slide. • The PCBs for every job are linked on the READY queue, and all of the PCBs for the jobs just entering the system are linked on the NEW queue.

  13. The jobs that are WAITING are linked into several queues whereby the jobs which are waiting for a specific I/O are grouped together. • E.g.: The PCBs for jobs that are waiting for the I/O on a specific disk drive are linked together while those waiting for the line printer are linked in a different queue. • These queues need to be managed in an orderly fashion.

  14. Thread • A thread is a single sequence stream within a process. • “Thread” refers to a single thread of instructions or thread of control. • Because threads have some of the properties of processes, they are sometimes called lightweight processes (LWP). • Processes are used to group resources together and threads are the entities scheduled for execution on the CPU. • In a process, threads allow multiple executions of streams. • In many respect, threads are popular way to improve application through parallelism. • The CPU switches rapidly back and forth among the threads giving illusion that the threads are running in parallel. • Like a traditional process i.e., process with one thread, a thread can be in any of several states (Running, Waiting, Ready or Terminated).

  15. Threads within a process share many of the process’s resources – most notably its address space and open files • A thread has or consists of a program counter (PC), a register set, and a stack space as well as thread-specific data (TSD) such as signal masks. • Threads are not independent of one other like processes as a result threads shares with other threads their code section, data section, OS resources  also known as task, such as open files and signals. • Depending on the thread implementation for the particular platform, threads may be managed by the operating system or by the user application that creates them.

  16. Threads VS Processes

  17. Thread Implementations • Thread implementations vary among operating systems. • Three most popular threading models: user-level threads, kernel-level threads and a combination of the two (hybrid).

  18. User Thread Kernel Thread

  19. Hybrid (Many-to-many) • Combination of user thread and kernel thread implementation is known as many-to-many thread mapping. • This implementation maps many user-level threads to a set of kernel threads.

More Related