5) One class of services provided by an operating system is to provide new functionality that is not supported directly by the underlying hardware.

Similar documents
W4118 Operating Systems. Instructor: Junfeng Yang

Objectives. Chapter 5: CPU Scheduling. CPU Scheduler. Non-preemptive and preemptive. Dispatcher. Alternating Sequence of CPU And I/O Bursts

CPU Scheduling. CPU Scheduling

Announcements. Basic Concepts. Histogram of Typical CPU- Burst Times. Dispatcher. CPU Scheduler. Burst Cycle. Reading

CPU Scheduling. Basic Concepts. Basic Concepts (2) Basic Concepts Scheduling Criteria Scheduling Algorithms Batch systems Interactive systems

Objectives. Chapter 5: Process Scheduling. Chapter 5: Process Scheduling. 5.1 Basic Concepts. To introduce CPU scheduling

Operating System: Scheduling

CS Fall 2008 Homework 2 Solution Due September 23, 11:59PM

Chapter 2: OS Overview

OPERATING SYSTEMS SCHEDULING

OS OBJECTIVE QUESTIONS

/ Operating Systems I. Process Scheduling. Warren R. Carithers Rob Duncan

Chapter 5 Process Scheduling

ICS Principles of Operating Systems

Scheduling. Scheduling. Scheduling levels. Decision to switch the running process can take place under the following circumstances:

PROCESS SCHEDULING ALGORITHMS: A REVIEW

Deciding which process to run. (Deciding which thread to run) Deciding how long the chosen process can run

Comp 204: Computer Systems and Their Implementation. Lecture 12: Scheduling Algorithms cont d

Process Scheduling CS 241. February 24, Copyright University of Illinois CS 241 Staff

Operating Systems. III. Scheduling.

Operating Systems, 6 th ed. Test Bank Chapter 7

Process Scheduling. Process Scheduler. Chapter 7. Context Switch. Scheduler. Selection Strategies

Operating Systems Concepts: Chapter 7: Scheduling Strategies

Road Map. Scheduling. Types of Scheduling. Scheduling. CPU Scheduling. Job Scheduling. Dickinson College Computer Science 354 Spring 2010.

A Comparative Study of CPU Scheduling Algorithms

CPU Scheduling Outline

Job Scheduling Model

Introduction. Scheduling. Types of scheduling. The basics

Scheduling. Yücel Saygın. These slides are based on your text book and on the slides prepared by Andrew S. Tanenbaum

2. is the number of processes that are completed per time unit. A) CPU utilization B) Response time C) Turnaround time D) Throughput

CPU Scheduling. Core Definitions

Chapter 6, The Operating System Machine Level

Operating Systems Lecture #6: Process Management

Chapter 5: CPU Scheduling. Operating System Concepts 8 th Edition

Main Points. Scheduling policy: what to do next, when there are multiple threads ready to run. Definitions. Uniprocessor policies

Chapter 1 8 Essay Question Review

This tutorial will take you through step by step approach while learning Operating System concepts.

CPU SCHEDULING (CONT D) NESTED SCHEDULING FUNCTIONS

Chapter 1 FUNDAMENTALS OF OPERATING SYSTEM

CS414 SP 2007 Assignment 1

Weighted Total Mark. Weighted Exam Mark

Chapter 1 13 Essay Question Review

A Group based Time Quantum Round Robin Algorithm using Min-Max Spread Measure

Operating Systems OBJECTIVES 7.1 DEFINITION. Chapter 7. Note:

Scheduling 0 : Levels. High level scheduling: Medium level scheduling: Low level scheduling

Operating Systems. Lecture 03. February 11, 2013

Processor Scheduling. Queues Recall OS maintains various queues

A LECTURE NOTE ON CSC 322 OPERATING SYSTEM I DR. S. A. SODIYA

Operating System Tutorial

Operatin g Systems: Internals and Design Principle s. Chapter 10 Multiprocessor and Real-Time Scheduling Seventh Edition By William Stallings

Comparison between scheduling algorithms in RTLinux and VxWorks

Performance Comparison of RTOS

Analysis and Comparison of CPU Scheduling Algorithms

Processes and Non-Preemptive Scheduling. Otto J. Anshus

Tasks Schedule Analysis in RTAI/Linux-GPL

Embedded Systems. 6. Real-Time Operating Systems

Module 8. Industrial Embedded and Communication Systems. Version 2 EE IIT, Kharagpur 1

CPU Scheduling 101. The CPU scheduler makes a sequence of moves that determines the interleaving of threads.

Project No. 2: Process Scheduling in Linux Submission due: April 28, 2014, 11:59pm

CS 377: Operating Systems. Outline. A review of what you ve learned, and how it applies to a real operating system. Lecture 25 - Linux Case Study

Chapter 19: Real-Time Systems. Overview of Real-Time Systems. Objectives. System Characteristics. Features of Real-Time Systems

REDUCING TIME: SCHEDULING JOB. Nisha Yadav, Nikita Chhillar, Neha jaiswal

218 Chapter 5 CPU Scheduling

COS 318: Operating Systems. Virtual Machine Monitors

CS0206 OPERATING SYSTEMS Prerequisite CS0201, CS0203

Lecture Outline Overview of real-time scheduling algorithms Outline relative strengths, weaknesses

Scheduling Algorithms

Real Time Programming: Concepts

Computer Science 4302 Operating Systems. Student Learning Outcomes

Technical Properties. Mobile Operating Systems. Overview Concepts of Mobile. Functions Processes. Lecture 11. Memory Management.

Convenience: An OS makes a computer more convenient to use. Efficiency: An OS allows the computer system resources to be used in an efficient manner.

Real-Time Component Software. slide credits: H. Kopetz, P. Puschner

Lesson Objectives. To provide a grand tour of the major operating systems components To provide coverage of basic computer system organization

Multiprocessor Scheduling and Scheduling in Linux Kernel 2.6

Lecture 3 Theoretical Foundations of RTOS

Semaphores and Monitors: High-level Synchronization Constructs

Operating System Components

Operating System Aspects. Real-Time Systems. Resource Management Tasks

CPU Scheduling. CSC 256/456 - Operating Systems Fall TA: Mohammad Hedayati

Syllabus MCA-404 Operating System - II

Operating System Components and Services

Overview Motivating Examples Interleaving Model Semantics of Correctness Testing, Debugging, and Verification

Readings for this topic: Silberschatz/Galvin/Gagne Chapter 5

CPU Scheduling. Multitasking operating systems come in two flavours: cooperative multitasking and preemptive multitasking.

Process Description and Control william stallings, maurizio pizzonia - sistemi operativi

! Past few lectures: Ø Locks: provide mutual exclusion Ø Condition variables: provide conditional synchronization

Real-Time Systems Prof. Dr. Rajib Mall Department of Computer Science and Engineering Indian Institute of Technology, Kharagpur

CSE 544 Principles of Database Management Systems. Magdalena Balazinska Fall 2007 Lecture 5 - DBMS Architecture

Operating System Organization. Purpose of an OS

Chapter 11 I/O Management and Disk Scheduling

Real-Time Scheduling 1 / 39

How To Understand The History Of An Operating System

REAL TIME OPERATING SYSTEMS. Lesson-10:

Scaling Networking Applications to Multiple Cores

Far-western University Central Office, Mahendranagar Operating System

OPERATING SYSTEM CONCEPTS

Chapter 7: Deadlocks!

Operating Systems. Module Descriptor

Transcription:

Benha University 2 nd Term (May 2014) Final Exam Class: 3 rd Year Students Subject: Operating Systems Faculty of Computers & Informatics Date: 17/5/2014 Time: 3 hours Answer the following questions:- Question No. (1) A. Multiple Choice: [10 points] 1) In the Round Robin (RR) scheduling; if the time quantum (q) is too large, then: A) Scheduling is same as First Come First Served (FCFS). B) More context switches will occur. C) The average turnaround time decreases. D) No effect. 2) Any solution to the critical section problem must satisfy the following three criteria: A) Disabling interrupts, TestAndSet instruction, and semaphores. B) Request, use and release. C) Mutual exclusion, no preemption, and circular-wait. D) Mutual exclusion, progress, and bounded waiting. 3) In First-Come-First-Served CPU scheduling algorithm, when the short processes wait for long process to finish its execution is called: A) Thrashing. B) Starvation. C) Page fault. D) Convoy effect. 4) Increasing the multiprogramming level can be accomplished by: A) Packing more processes into memory. B) Reducing memory fragmentation. C) Sharing code and data among different processes. D) All of the above 5) One class of services provided by an operating system is to provide new functionality that is not supported directly by the underlying hardware. 6) If the web server runs as a single-threaded process, it would be able to service many clients at a time. 7) The most important CPU scheduling criteria to be optimized in an interactive operating system is: A) Response time. B) Waiting time. C) Throughput. D) Turnaround time. Committee of Examiners and correctors: 1 st Member/ 2 nd Member/ Page 1 of 7

8) If all processes are CPU bound, the I/O waiting queues will almost always be empty. 9) When both send( ) and receive( ) are blocking, we have a rendezvous between the sender and the receiver. 10) In the indirect communication, a communication link has the following property: A) A link is associated with exactly two processes. B) A link is established only if the pair processes have a shared mailbox. C) A link is established automatically between every pair of processes. D) Between each pair of processes, there exists exactly one link. B. [6 points] Consider the following set of processes to solve the questions I, II and III. (Select the correct answer) Process Arrival Time Burst Time Priority F 0 6 5 G 2 3 3 H 3 2 4 I 7 5 2 I) The Gantt chart for Shortest-Job-First (SJF) scheduling algorithm is: A) B) C) E) None of them F F G H H G G F F F F I I I I I F F G G G H H F F F F I I I I I F F F F F F H H G G G I I I I I II) The Gantt chart for non-preemptive priority scheduling algorithm is: (Low number high priority) A) B) C) E) None of them F F F F F F G G G I I I I I H H F F G G G H H I I I I I F F F F F F F F F F G G G H H I I I I I III) The average waiting time using SJF in question I is: A) 2.5 B) 4 C) 1.75 D) 3.25 E)None of them Committee of Examiners and correctors: 1 st Member/ 2 nd Member/ Page 2 of 7

Question No. (2) 1-[3 points] The following events may occur to a process. Identify the starting state it is in at the time of the event and the ending state it transitions to. Event Starting state Ending state Scheduler dispatches process I/O complete Process admitted to ready queue for first time Scheduler preempts (interrupts) process Process finishes execution (task is complete) Process initiates I/O 2-[3 points] Draw a diagram to illustrate the components of the Linux system. 3-[4 points] What is the purpose of system calls? Why we use APIs rather than system calls? 4-[3 points] Clarify what is dual mode operation. 5- List and describe briefly each of the following A. Three different types of processes scheduler [3 points] B. Four Operating system structures [4 points] C. Four Threading issues [4 points] 6- [4 points] Explain what semaphore is and Illustrate using three examples the various types of errors that can be generated when programmers use semaphores incorrectly to solve the criticalsection problem. 7- [5 points] Distinguish between message passing model and shared memory model (Make sure to clarify the role of the operating system in each). 8- [5 points] What is the difference between a process and a thread? Describe three different multithreading models for mapping user threads to kernel threads. 9- [6 points] Explain how operating systems have evolved over the years and provide three reasons for this evolution. Committee of Examiners and correctors: 1 st Member/ 2 nd Member/ Page 3 of 7

10- [5 points] The following pair of processes share a common variable X: Before either process begins execution X = 5. As usual, statements within a process are executed sequentially, but statements in process A may execute in any order with respect to statements in process B. A) Describe how a race condition is possible and show how many different values of X are possible after both processes finish executing? B) Using two semaphores S and T, modify the processes so that the only possible value of X is 6. With my best wishes Committee of Examiners and correctors: 1 st Member/ 2 nd Member/ Page 4 of 7

Event Starting state Ending state Program started by user Does not exist New Scheduler dispatches process Ready Running I/O complete Waiting Ready Process admitted to ready queue for first time New Ready Scheduler preempts (interrupts) process Running Ready Process finishes execution (task is complete) Running Terminated Process initiates I/O Running Waiting Semaphore is Semaphore S integer variable That is accessed only through two standard atomic operations to modify S: wait() and signal() Originally called P () for wait() an atomic operation that waits for semaphore to become positive, then decrements it by one. V() for signal()- an atomic operation that increments the semaphore by one, waking up a waiting P, if any. Examples of misuse: mutex is a semaphore which is initialized to 1 signal (mutex). wait (mutex) results in a violation of the mutual exclusion requirement wait (mutex) wait (mutex) Committee of Examiners and correctors: 1 st Member/ 2 nd Member/ Page 5 of 7

results in deadlock Omitting of wait (mutex) or signal (mutex) (or both) Either mutual exclusion is violated or a deadlock will occur a) What is race condition? How many different values of X are possible after both processes finish executing? Race Condition Race Condition (a race between two processes who will finish first) Multiple processes or threads read and write data items They do so in away where final result depends on the order of execution of the processes. The output depends on who finishes the race last Why do race conditions occur whenever the state of a shared resource depends on the precise execution order of the processes Scheduling: Context switches at arbitrary times during execution A1 A2 B1 B2: X = 11 A1 B1 A2 B2: X = 6 A1 B1 B2 A2: X = 10 B1 A1 B2 A2: X = 10 B1 A1 A2 B2: X = 6 B1 B2 A1 A2: X = 12 b) Using two semaphores S and T, modify the processes so that the only possible value of X is 6. To ensure a final value of 6, there are two precedence constraints to be enforced: B1 > A2 and A2 > B2. A1 and B1 can happen in any order. // indicate semaphore initial values here Semaphore S = 0, T = 0 ; A1: Y = X*2; B1: Z = X+1; wait(s); A2: X = Y; B2: X = Z; signal(t); Threading Issues Semantics of fork() and exec() system calls Thread cancellation Signal handling Thread local storage Scheduler activations signal(s); wait(t); Committee of Examiners and correctors: 1 st Member/ 2 nd Member/ Page 6 of 7

A major OS will evolve over time for a number of reasons: Hardware upgrades plus new types of hardware New services: In response to user demand or in response to the needs of system managers, the OS expands to offer new services. Fixes: Any OS has faults. These are discovered over the course of time and fixes are made. Of course, the fix may introduce new faults. 1. The shared-memory method requires communicating processes to share some variables. The processes are expected to exchange information through the use of these shared variables. In a shared-memory system, the responsibility for providing communication rests with the application programmers; the operating system needs to provide only the shared memory. 2. The message-passing method allows the processes to exchange messages. The responsibility for providing communication may rest with the operating system itself. These two schemes are not mutually exclusive and can be used simultaneously within a single operating system. 8-A Relationship between user threads and kernel threads. Many-to-One One-to-One Many-to-Many The operating system must select processes from various scheduling queues. Long-term (job) scheduling is the selection of processes that will be allowed to contend for the CPU. Normally, long-term scheduling is heavily influenced by resource-allocation considerations, especially memory management. Short-term (CPU) scheduling is the selection of one process from the ready queue. a. Operating System Structure i. Simple Structure ii. Layered Structure iii. Microkernel System Structure iv. Modular Kernel Structure Committee of Examiners and correctors: 1 st Member/ 2 nd Member/ Page 7 of 7