Operating Systems: Types, Features, and Real-Time Scheduling, Lecture notes of Operating Systems

An overview of operating system types, focusing on batch, time-sharing, and real-time systems. It discusses their features, components, and scheduling policies. Real-time systems are further explored, with a focus on real-time tasks, scheduling, and preemption.

Typology: Lecture notes

2015/2016

Uploaded on 03/16/2016

Peter.Mark
Peter.Mark 🇳🇬

1 document

1 / 16

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Operating System (OS)
types – Scheduling policies
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff

Partial preview of the text

Download Operating Systems: Types, Features, and Real-Time Scheduling and more Lecture notes Operating Systems in PDF only on Docsity!

Operating System (OS)

types – Scheduling policies

Operating system types

  • (^) Historically, OS are classified into the following

categories – Batch, Time sharing multi-user, Single user,

Real-Time, Networking, and Multiprocessing

  • (^) Classification is based largely on the level of interaction

between user applications / processes on one hand and

the processor and other system resources on the other

hand

  • (^) Today, most OS provide a wide range of services on

diverse platforms e.g. Batch, time sharing, single user,

real time, and networking services can be found in one

OS e.g. as in MS Windows, Linux, and Macintosh OS

BATCH SYSTEMS Features/ Components

  • (^) Multiuser, multiprogramming
  • (^) Characterised by low or minimal level of interaction between user and process execution
  • (^) Involves submission of “jobs”
  • (^) Used for running applications that require little or no user intervention, in the background
  • (^) Useful for running applications with large files or data sets

Batch OS - continued

  • (^) Interrupt support mechanism - required for Multiprogramming and Direct Memory Access (DMA).
  • (^) With interrupt-driven I/O or DMA, the processor can issue an I/O command for one job and proceed with the execution of another job while the I/O is carried out by the device controller. When the I/O operation is complete, the processor is interrupted and control is passed to an interrupt-handling program in the operating system. The operating system will then pass control to the job interrupted at the point of interruption.
  • (^) Memory management required. - for several jobs which are ready to run, & which must be kept in main memory. Technique is Fixed Partitioning - main memory is divided into a number of static partitions at system generation time. A process may be loaded into a partition of equal or greater size.

Privileged Instructions

  • (^) Certain instructions are designated as privileged and can

be executed only by the OS. If the processor encounters

such an instruction while executing a user program, an

error interrupt occurs. Among the privileged instructions

are I/O instructions and job control instructions, so that

the OS retains control of all I/O devices. This prevents,

for example, a user program from accidentally reading

job control instructions from the next job. If a user

program wishes to perform I/O, it must request that the

OS performs the operation for it. If a privileged

instruction is encountered by the processor while it is

executing a user program, the processor hardware

considers this an error and transfers control to the OS.

  • (^) Job Control Language Interpreter is required.

TIME- SHARING SYSTEMS Features/Components

  • (^) Introduction to Time sharing systems
  • (^) A system clock - this generates interrupts at a rate approximated to a quantum. At each clock interrupt, the OS regains control and could assign the processor to another user. Thus, at regular intervals, the current user would be preempted and another user loaded in – Round-Robin.
  • (^) Memory management: Paged virtual memory. This requires both hardware and software support. The hardware support is provided by the processor. The support includes dynamic translation of virtual addresses to physical addresses and the generation of an interrupt when a referenced page is not in main memory - such an interrupt triggers the memory management software in the operating system.
  • (^) File management - With multiple interactive users, the file system must be protected so that only authorized users have access to a particular file.

REAL-TIME SCHEDULING

  • (^) We can define a real-time system by defining what is meant by a real-time process, or task. In general, in a real-time system, some of the tasks are real-time tasks, and they have a certain degree of urgency to them. Such tasks are attempting to control or react to events that take place in the outside world. Because these events occur in "real time," a real-time task must be able to keep up with the events with which it is concerned. Thus, it is usually possible to associate a deadline with a particular task when the deadline specifies either a start time or a completion time. Such a task may be classified as hard or soft. A hard real-time task must meet its deadline; otherwise it will cause undesirable damage or a fatal error to the system. A soft real-time task has an associated deadline, which is desirable but not mandatory; it still makes sense to schedule and complete the task even if it has passed its deadline.
  • (^) Another characteristic of real-time tasks is whether they are periodic or aperiodic. An aperiodic task has a deadline by which it must finish or start, or it may have a constraint on both start and finish time. In the case of a periodic task, the requirement may be stated as "once per period T" or "exactly T units apart."

Real-Time Preemption The basic characteristics of current real-time operating systems include the following:

  • (^) Fast context switch
  • (^) Small size (with its associated minimal functionality)
  • (^) Ability to respond to external interrupts quickly
  • (^) Multitasking with inter process communication tools such as semaphores, signals, and events
  • (^) Use of special sequential files that can accumulate data at a fast rate
  • (^) Preemptive scheduling based on priority
  • (^) Minimization of intervals during which interrupts are disabled
  • (^) Primitives to delay tasks for a fixed amount of time and to pause/resume tasks
  • (^) Special alarms and timeouts
  • (^) The heart of a real-time system is the short-term task scheduler. In designing such a scheduler, fairness and minimizing average response time are not important. What is important is that all hard real-time tasks complete (or start) by their deadline' and that as many as possible soft real-time tasks also complete (or start) by their deadline.

Real-Time Scheduling…

  • (^) This could lead to a delay of several seconds if a slow low-priority task were executing at a critical time. Again, this approach is not acceptable. A more promising approach is to combine priorities with clock-based interrupts. Preemption points occur at regular intervals. When a preemption point occurs, the currently running task is preempted if a higher-priority task is waiting, including the preemption of tasks that are part of the operating-system kernel. Such a delay may be on the order of several milliseconds (Figure lc).
  • (^) Although this last approach may be adequate for some real-time applications, it does not suffice for more demanding applications, in which cases, the approach that is taken is sometimes referred to as immediate preemption. In immediate preemption, the operating system responds to an interrupt almost immediately unless the system is in a critical-code lockout section. Scheduling delays for a real-time task can then reduced to 100 microsecond or less.

Deadline Scheduling

  • (^) Most contemporary real-time operating systems are designed with the objective of starting real-time tasks as rapidly as possible, and hence they emphasize rapid interrupt handling and task dispatching. In fact, this is not a particularly useful metric in evaluating real-time operating systems. Real-time applications are generally not concerned with sheer speed but with completing (or starting) tasks at the most valuable times neither too early or too late, despite dynamic resource demands and conflicts, processing overloads, and hardware or software faults. It follows that priorities provide a crude tool and do not capture the requirement, "completion (or initiation) at the most valuable time."
  • (^) In recent years, there have been a number of proposals for more powerful and appropriate approaches to real-time task scheduling. All these are based on having additional information about each task. In its most general form, the following information about each task might be used:
  • (^) Starting deadline: Time by which a task must begin.
  • (^) Completion deadline: Time by which task must be completed. The typical real-time application has either starting deadlines or completion deadlines but not both.
  • (^) Processing time: The time required to execute the task to completion. In some cases, this time is supplied. In others, the operating system measures an exponential average. For still other scheduling systems, this information is not used.
  • (^) Resource requirements: the set of resources (other than the processor) required by the task while it is executing.
  • (^) Priority: Measures relative importance of the task. Hard real-time tasks may have an "absolute" priority, with the system failing if a deadline is missed. If the system is to continue to run no matter what, then both hard and soft real-time tasks may be assigned relative priorities as a guide to the scheduler.
  • (^) Subtask structure: A task may be decomposed into a mandatory subtask and an optional subtask. Only the mandatory subtask has a hard deadline.