Unit 1 - Introduction to Operating Sytem & Unit 2 - Process Characterization

 

Courtesy : https://www.tutorialtpoint.net/p/operating-system-tutorial.html

 

What is Operating System?

            Operating System is System software installed on any computer device once at first to do all mandatory processes of computer from booting to shutdown.

            Operating System is a computer program to do control and handle all kind of process of the computer.

            Operating System is an interface between hardware and application software.

            An operating system is software which performs all management tasks like

§  file management

§  memory management

§  process management

§  handling input and output

§  Controlling peripheral devices such as disk drives and printers.

 

History and Evolution of OS

 

Basic OS functions

 

Resource Abstraction

 

Types of Operating Systems–

 

o   Multiprogramming Systems,

o   Batch Systems,

o   Time Sharing Systems;

Multiprogramming Systems,

Multiprogramming Systems can be simply illustrated as more than one program is present in the main memory and any one of them can be kept in execution. This is basically used for better execution of resources.

 

 

 

Advantages

  • Multi Programming increases the Throughput of the System.
  • It helps in reducing the response time.

Disadvantages

  • There is not any facility for user interaction of system resources with the system.

 

 

 

 

Batch Systems

          Batch System Operating System (BSOS) allow the processor to do the jobs from various users in batch wise.

 

 

Advantages

  • It is very difficult to guess or know the time required for any job to complete.
  • Processors of the batch systems know how long the job would be when it is in the queue.
  • Multiple users can share the batch systems.
  • The idle time for the batch system is very less.
  • It is easy to manage large work repeatedly in batch systems.

Disadvantages

  • The computer operators should be well known with batch systems.
  • Batch systems are hard to debug.
  • It is sometimes costly.
  • The other jobs will have to wait for an unknown time if any job fails.

 

 

Time Sharing Systems

          Time Sharing Operating System( TSOS) is a discontinued operating system for RCA mainframe computers of the Spectra 70 series. TSOS was originally designed in 1968 for the Spectra 70/46, a modified version of the 70/45. TSOS quickly evolved into the Virtual Memory Operating System by 1970.

 

 

Advantages

  • Less response time.
  • CPU idle time is very high.
  • Each task is assigned to certain time limit.
  • Reduced duplication of program which improves reaction time.
  • User-friendly and easy to use.

 

 

 

Dis-Advantages

·         Specification of hardware is high.

·         Reliability is poor.

·         Security and integrity of user programs and data is also poor

·         Data communication problem.

 

 

 

 

 

 

 

 

 

Operating Systems for

            Personal Computers,

            Workstations and

            Hand-held Devices,

 

                        Personal computers (PCs), are electronic devices, which come with pre-installed     special software called an operating system (OS).

                        Workstations are the common desktop computers which are connected in a            network Eg computers connected on Local Area Network

                        Handheld devices are small computing equipment which can be easily carry out     anywhere. Eg – smart phone, smart watches, tablets.

           

 

            Windows Operating System

                        Windows OS is a computer program which controls or manages all computer resources and provide services to the computer applications installed           on the particular device. It is developed by Canonical Ltd, UK-based company.

            Functions:

·         Managing computer resources

·         Act as Interface between hardware and software

·         Offering compatibility

 

            Linux Operating System

           

 

            Ubuntu

                        Ubuntu is an open source free system software operating system that runs from      the desktop, to the cloud, to all of internet connected things. It is Linux based operating          system. It was initially developed in October 2004 as ubuntu4.10. it is compatible for all kind of device like desktop to IoT devices.

           

            Advantages

·         Free licence

·         Coding can be easily modify

·         Can be customized and distribute freely

·         Come with built-in antivirus software

·         Hardware auto configuration

·         Can run without install

 

Disadvantages

·         Compatible issues with hw and sw

·         Linux are better than in many situations

·          Small no of gaming features

·         Limited functionality

·         Issue commercialization vs open source

 

            Android

                        Android is lightweight , portable and complete system software for all        kind of handheld devices like smart phone smart watches setup boxes tablets etc

            It is also linux based operating system.

           

 Process Control & Real time Systems.

 Process Control Block (PCB)

If the OS supports multiprogramming, then it needs to keep track of all the processes. For each process, its process control block PCB is used to track the process's execution status, including the following:

  • Its current processor register contents.
  • Its processor state (if it is blocked or ready).
  • Its memory state.
  • A pointer to its stack.
  • Which resources have been allocated to it.
  • Which resources it needs 

Real time Systems /RTOS

Real-Time systems span several domains of computer science. They are defense and space systems, networked multimedia systems, embedded automative electronics etc. In a real-time system the correctness of the system behavior depends not only the logical results of the computations, but also on the physical instant at which these results are produced. A real-time system changes its state as a function of physical time, e.g., a chemical reaction continues to change its state even after its controlling computer system has stopped. Based on this a real-time system can be decomposed into a set of subsystems i.e., the controlled object, the real-time computer system and the human operator. A real-time computer system must react to stimuli from the controlled object (or the operator) within time intervals dictated by its environment. The instant at which a result is produced is called a deadline. If the result has utility even after the deadline has passed, the deadline is classified as soft, otherwise it is firm. If a catastrophe could result if a firm deadline is missed, the deadline is hard. Commands and Control systems, Air traffic control systems are examples for hard real-time systems. On-line transaction systems, airline reservation systems are soft real-time systems. 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Important questions: 1 marks

1. Which one of the following is an Operating System? 

a) Windows                                                     b) Linux

c) UNIX                                                          d) All of the above

 

2, Expansion of GMOS is

a) Global Method Operating System             b) General Motor Operating System

c) Graphical Mode Operating System            d) General Motor Opening System

 

3. ------------------------------ is the system software to manage system Hardware.

a) Operating System                                      b) Application Software

c) Database Management System                  d) Web application System

 

4. ------------------------------- is the process of running several programs at a time.

a) Multiprogramming                                               b) Multitasking

c) Multiprocessing                                                      d) Multioperating

 

5. ------------------------------ allows user to perform more than one task at a time.

a) Time sharing                                                b) Resource sharing

c) Batch Processing                                      d) None

 

6. ------------------------------ allows user to process several jobs at a time.

a) Resource sharing                                         b) Time sharing

c) Batch Processing                                      d) All of the above

 

2 marks

1.      Define Operating System

2.      Define workstation

3.      Define Batch System

4.      Define Multiprogramming

5.      Define Time Sharing System

15 marks

1.      Explain in detail about History and evolution of Operating System.

2.      Describe about

             i)  Multi programming system

             ii) Batch system                     

             iii)Time sharing system         

3.      Describe Operating System Concepts with neat diagram.

4.      Describe different types of Operating systems

5.      Explain Process control and Real Time Operating System.

                                                       **************

 

 

 

 

 

 

Unit :2

 

 

Processor and User Modes, Kernels Modes

 

Depending on the types of coding to be executed the Processor swaps its control between User Mode and Kernel Mode

User mode is the user friendly mode, Top most Layer, and it is used for working applications

Kernel mode is the hw friendly mode, most near mode to hw, to work on most essential part of os process.

User Mode:

When you start a user-mode application, Windows creates a process for the application. 

The process provides the application with a private virtual address space and a private handle table. Because an application's virtual address space is private, one application can't alter data that belongs to another application. 

Each application runs in isolation, and if an application crashes, the crash is limited to that one application. Other applications and the operating system aren't affected by the crash.

A user-mode application's virtual address space is constrained in addition to being private. Virtual addresses that are set aside for the operating system cannot be accessed by a process running in user mode. A user-mode application's virtual address area can be restricted to stop it from changing and potentially harming crucial operating system data.

Kernel Mode:

The single virtual address space is shared by all kernel mode code. A kernel-mode driver isn't separate from other drivers or the operating system as a whole because of this. Data belonging to the operating system or another driver may be compromised if a kernel-mode driver unintentionally writes to the incorrect virtual address. The entire operating system fails if a kernel-mode driver malfunctions.

 

 

System Calls and System Programs

          System Call – is a Technique used to communicate between system software and operating system. It act as a bridge between system programs  and operating system. It takes request from system programs and

 

System View of the Process and Resources

 

Abstraction is the action of simplifying or hiding the detailed procedure from the end user.

Eg.  cinema script, thesis abstract

 

 

System Abstraction – hw abstraction

 

Process Abstraction – sw abstraction

 

Process Hierarchy

 

Threads

          Thread is the light weight stream sequence within a process. It is  the flow of execution of a task. Thread is the basic unit to allocate processor time by the os. Types of threads are user threads and kernel threads or os threads. Threads are faster than process , because it requires less resources.

Threading Issues

  • System Call.
  • Thread Cancellation.
  • Signal Handling.
  • Thread Pool.
  • Thread Specific Data.
  • Deadlocks
  • Race conditions
  • Synchronization errors

Thread Libraries

Thread libraries provide common way to work with thread over various operating systems and platforms.

  Create a Default Thread"

  "Wait for Thread Termination"

  "Detaching a Thread"

 

 

 

Process Scheduling

Process scheduling is the task of the process manager that remove the running process from the CPU and select the another process based on a particular strategy. Process scheduling is an essential part of a Multiprogramming operating system. Such operating systems allow more than one process to be loaded and run in the executable memory at a time and the loaded process shares the CPU using time multiplexing.

 

Categories

·         Non-preemptive: A process’s resource cannot be taken before the process has finished running. When a running process finishes and control transiits to a ”waiting state” -  resources are switched.

·         Preemptive: The OS assigns resources to a process for a predetermined period. The process switches from running state to ready state or from waiting for state to ready state during resource allocation. This switching happens because the CPU may give other processes priority and substitute the currently active process for the higher priority process.

 

Types of Process Schedulers

There are three types of process schedulers:

Long Term or Job Scheduler – Create – Ready state

Short Term or CPU Scheduler – Ready – Running state

Medium-Term Scheduler – Suspend / wait / block state

 

Preemptive Scheduling

Preemptive scheduling is used when a process switches from the running state to the ready state or from the waiting state to the ready state. The resources (mainly CPU cycles) are allo

cated to the process for a limited amount of time and then taken away, and the process is again placed back in the ready queue if that process still has CPU burst time remaining. That process stays in the ready queue till it gets its next chance to execute. 

Algorithms based on preemptive scheduling are Round Robin (RR)Shortest Remaining Time First (SRTF)Priority (preemptive version), etc. 

 

Advantages

1.      Because a process may not monopolize the processor, it is a more reliable method.

2.      Each occurrence prevents the completion of ongoing tasks.

3.      The average response time is improved.

4.      Utilizing this method in a multi-programming environment is more advantageous.

5.      The operating system makes sure that every process using the CPU is using the same amount of CPU time.

Disadvantages

1.      Limited computational resources must be used.

2.      Suspending the running process, change the context, and dispatch the new incoming process all take more time.

3.      The low-priority process would have to wait if multiple high-priority processes arrived at the same time.

 

 

Non-Preemptive Scheduling

Non-preemptive Scheduling is used when a process terminates, or a process switches from running to the waiting state. In this scheduling, once the resources (CPU cycles) are allocated to a process, the process holds the CPU till it gets terminated or reaches a waiting state. In the case of non-preemptive scheduling does not interrupt a process running CPU in the middle of the execution. Instead, it waits till the process completes its CPU burst time, and then it can allocate the CPU to another process. 

Algorithms based on non-preemptive scheduling are: Shortest Job First (SJF basically non preemptive) and Priority (nonpreemptive version), etc. 

 

Non-preemptive scheduling has both advantages and disadvantages. The following are non-preemptive scheduling’s benefits and drawbacks:

Advantages

1.      It has a minimal scheduling burden.

2.      It is a very easy procedure.

3.      Less computational resources are used.

4.      It has a high throughput rate.

Disadvantages

1.      Its response time to the process is super.

2.      Bugs can cause a computer to freeze up.
 

 

Key Differences Between Preemptive and Non-Preemptive Scheduling

1.      In preemptive scheduling, the CPU is allocated to the processes for a limited time whereas, in Non-preemptive scheduling, the CPU is allocated to the process till it terminates or switches to the waiting state.

2.      The executing process in preemptive scheduling is interrupted in the middle of execution when a higher priority one comes whereas, the executing process in non-preemptive scheduling is not interrupted in the middle of execution and waits till its execution.

3.      In Preemptive Scheduling, there is the overhead of switching the process from the ready state to the running state, vise-verse, and maintaining the ready queue. Whereas in the case of non-preemptive scheduling has no overhead of switching the process from running state to ready state.

4.      In preemptive scheduling, if a high-priorThe process The process non-preemptive low-priority process frequently arrives in the ready queue then the process with low priority has to wait for a long, and it may have to starve. , in non-preemptive scheduling, if CPU is allocated to the process having a larger burst time then the processes with a small burst time may have to starve.

5.      Preemptive scheduling attains flexibility by allowing the critical processes to access the CPU as they arrive in the ready queue, no matter what process is executing currently. Non-preemptive scheduling is called rigid as even if a critical process enters the ready queue the process running CPU is not disturbed.

6.      Preemptive Scheduling has to maintain the integrity of shared data that’s why it is cost associative which is not the case with Non-preemptive Scheduling.

 

 

 

 

 

 

 

 

 

 

 

Comparison Chart

Parameter                       

PREEMPTIVE SCHEDULING

NON-PREEMPTIVE SCHEDULING

Basic

In this resources(CPU Cycle) are allocated to a process for a limited time.

Once resources(CPU Cycle) are allocated to a process, the process holds it till it completes its burst time or switches to waiting state.

Interrupt

Process can be interrupted in between.

Process can not be interrupted until it terminates itself or its time is up.

Starvation

If a process having high priority frequently arrives in the ready queue, a low priority process may starve.

If a process with a long burst time is running CPU, then later coming process with less CPU burst time may starve.

Overhead

It has overheads of scheduling the processes.

It does not have overheads.

Flexibility

flexible

rigid

Cost

cost associated

no cost associated

CPU Utilization

In preemptive scheduling, CPU utilization is high.

It is low in non preemptive scheduling.

Waiting Time

Preemptive scheduling waiting time is less.

Non-preemptive scheduling waiting time is high.

Response Time

Preemptive scheduling response time is less.

Non-preemptive scheduling response time is high.

Decision making 

Decisions are made by the scheduler and are based on priority and time slice allocation 

Decisions are made by the process itself and the OS just follows the process’s instructions
 

Process control 

The OS has greater control over the scheduling of processes 

The OS has less control over the scheduling of processes
 

Overhead 

Higher overhead due to frequent context switching 

Lower overhead since context switching is less frequent
 

Examples

Examples of preemptive scheduling are Round Robin and Shortest Remaining Time First.

Examples of non-preemptive scheduling are First Come First Serve and Shortest Job First.

 

 

 

 

Question Bank

1.      ----------------- is a Technique used to communicate between system software and operating system.

2.      Abstraction is the action of simplifying or hiding the detailed procedure from the end user.

3.      Threads

4.      Scheduling

5.      Preemptive/Non preemptive Scheduling Algorithm

 

2        marks

1.      The types of threads.

2.      Write another term for “process scheduling”.

3.      What is Burst Time?

4.      Expand PCB.(Process Control Block)

5.      Write any advantages or disadvantages of Process scheduling algorithms(preemptive and non preemptive)

 

 

15 marks

1.      Process Abstraction and hierarchy

2.      Threads, thread issues and Libraries

3.      Process Scheduling.

4.      User Mode and Kernal mode

 

*************************

 

Comments

Popular posts from this blog

Unit 3 : Regression

Operating System - Unit - 4 Memory Management and File Managment