TENTAMEN / EXAM. TDDB68 Processprogrammering och operativsystem / Concurrent programming and operating systems

Similar documents
TENTAMEN / EXAM. TDDB68 / TDDB72 Processprogrammering och operativsystem / Concurrent programming and operating systems 14 jan 2009, 08:00 12:00 TER2

TDDB68 Processprogrammering och operativsystem / Concurrent programming and operating systems

TENTAMEN / EXAM. General instructions

TDDB68 Processprogrammering och operativsystem / Concurrent programming and operating systems , 14:00 18:00

EXAM (Tentamen) TDDI11 Embedded Software. Good Luck! :00-12:00. On-call (jour): Admitted material: General instructions:

Department of Computer applications. [Part I: Medium Answer Type Questions]

Operating Systems Comprehensive Exam. Spring Student ID # 3/16/2006

Operating Systems Comprehensive Exam. Spring Student ID # 2/17/2011

CSC Operating Systems Spring Lecture - XII Midterm Review. Tevfik Ko!ar. Louisiana State University. March 4 th, 2008.

CS 571 Operating Systems. Midterm Review. Angelos Stavrou, George Mason University

CSE 153 Design of Operating Systems

General Objectives: To understand the process management in operating system. Specific Objectives: At the end of the unit you should be able to:

Operating Systems (1DT020 & 1TT802)

(b) External fragmentation can happen in a virtual memory paging system.

Midterm Exam. October 20th, Thursday NSC

Lecture 9: Midterm Review

Main Points of the Computer Organization and System Software Module

Last Class: Deadlocks. Today

Operating Systems Comprehensive Exam. Spring Student ID # 3/20/2013

SAMPLE MIDTERM QUESTIONS

Operating Systems: Quiz2 December 15, Class: No. Name:

Last Class: CPU Scheduling! Adjusting Priorities in MLFQ!

CMPS 111 Spring 2013 Prof. Scott A. Brandt Midterm Examination May 6, Name: ID:

Homework Assignment #5

CSE 120 PRACTICE FINAL EXAM, WINTER 2013

QUESTION BANK UNIT I

ENGR 3950U / CSCI 3020U UOIT, Fall 2012 Quiz on Process Synchronization SOLUTIONS

CHAPTER NO - 1 : Introduction:

CSc33200: Operating Systems, CS-CCNY, Fall 2003 Jinzhong Niu December 10, Review

COMP 300E Operating Systems Fall Semester 2011 Midterm Examination SAMPLE. Name: Student ID:

Operating Systems Comprehensive Exam. Fall Student ID # 10/31/2013

Example Sheet for Operating Systems I (Part IA)

COMP SCI 3SH3: Operating System Concepts (Term 2 Winter 2006) Test 2 February 27, 2006; Time: 50 Minutes ;. Questions Instructor: Dr.

Last Class: Synchronization Problems. Need to hold multiple resources to perform task. CS377: Operating Systems. Real-world Examples

CS 318 Principles of Operating Systems

COMP 3361: Operating Systems 1 Final Exam Winter 2009

Operating Systems EDA092, DIT 400 Exam

STUDENT NAME: STUDENT ID: Problem 1 Problem 2 Problem 3 Problem 4 Problem 5 Total

Example Sheet for Operating Systems I (Part IA)

MC7204 OPERATING SYSTEMS

Operating Systems Structure

Sample Questions. Amir H. Payberah. Amirkabir University of Technology (Tehran Polytechnic)

Q 1. (10 Points) Assume that a process executes the following pseudo codes:

Midterm Exam Amy Murphy 6 March 2002

COMP 3361: Operating Systems 1 Midterm Winter 2009

CS604 - Operating System Solved Subjective Midterm Papers For Midterm Exam Preparation

UNIT:2. Process Management

Assignment 3 (Due date: Thursday, 10/15/2009, in class) Part One: Provide brief answers to the following Chapter Exercises questions:

( B ) 4. Which is not able to solve the race condition? (A) Test and Set Lock (B) Shared memory (C) Semaphore (D) Monitor

Remaining Contemplation Questions

Operating Systems (Classroom Practice Booklet Solutions)

CS-537: Midterm Exam (Spring 2001)

CSE 120. Fall Lecture 8: Scheduling and Deadlock. Keith Marzullo

AC59/AT59/AC110/AT110 OPERATING SYSTEMS & SYSTEMS SOFTWARE DEC 2015

Midterm Exam Solutions Amy Murphy 28 February 2001

PESIT SOUTHCAMPUS. Question Bank

CPU Scheduling Algorithms

Operating Systems Comprehensive Exam. There are five questions on this exam. Please answer any four questions total

Operating System(16MCA24)

Maximum CPU utilization obtained with multiprogramming. CPU I/O Burst Cycle Process execution consists of a cycle of CPU execution and I/O wait

CS630 Operating System Design, Second Exam, Fall 2014

CSE 120 Principles of Operating Systems

CMPS 111 Spring 2003 Midterm Exam May 8, Name: ID:

CS370 Operating Systems

OPERATING SYSTEMS ECSE 427/COMP SECTION 01 WEDNESDAY, DECEMBER 7, 2016, 9:00 AM

8: Scheduling. Scheduling. Mark Handley

Operating Systems Prof. Allan Gottlieb Practice Final Exam Page 1 Name

FCM 710: Architecture of Secure Operating Systems

COS 318: Midterm Exam (October 23, 2012) (80 Minutes)

Review. Preview. Three Level Scheduler. Scheduler. Process behavior. Effective CPU Scheduler is essential. Process Scheduling

CS 153 Design of Operating Systems Winter 2016

CMPSCI 377: Operating Systems Exam 1: Processes, Threads, CPU Scheduling and Synchronization. October 9, 2002

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

1995 Paper 10 Question 7

FCM 710: Architecture of Secure Operating Systems

CSC 716 Advanced Operating System Fall 2007 Exam 1. Answer all the questions. The maximum credit for each question is as shown.

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING UNIT I

8th Slide Set Operating Systems

CPS 110 Midterm. Spring 2011

Lecture 5 / Chapter 6 (CPU Scheduling) Basic Concepts. Scheduling Criteria Scheduling Algorithms

CSI3131 Final Exam Review

Resource management. Real-Time Systems. Resource management. Resource management

SNS COLLEGE OF ENGINEERING

CS630 Operating System Design, First Exam, Spring 2017,

CSE 4/521 Introduction to Operating Systems

Midterm Exam Amy Murphy 19 March 2003

INSTITUTE OF AERONAUTICAL ENGINEERING Dundigal, Hyderabad COMPUTER SCIENCE AND ENGINEERING QUESTION BANK OPERATING SYSTEMS

Concurrency: Deadlock and Starvation

Chapter 5: CPU Scheduling

CPU Scheduling. Daniel Mosse. (Most slides are from Sherif Khattab and Silberschatz, Galvin and Gagne 2013)

Real-Time Systems. Lecture #4. Professor Jan Jonsson. Department of Computer Science and Engineering Chalmers University of Technology

CS 370 Operating Systems

GATE SOLVED PAPER - CS

Lecture 2 Process Management

Lecture Topics. Announcements. Today: Uniprocessor Scheduling (Stallings, chapter ) Next: Advanced Scheduling (Stallings, chapter

Subject Name: OPERATING SYSTEMS. Subject Code: 10EC65. Prepared By: Kala H S and Remya R. Department: ECE. Date:

CPSC/ECE 3220 Summer 2017 Exam 2

Properties of Processes

Techno India Batanagar Department of Computer Science & Engineering. Model Questions. Multiple Choice Questions:

OS 1 st Exam Name Solution St # (Q1) (19 points) True/False. Circle the appropriate choice (there are no trick questions).

Transcription:

Linköpings universitet IDA Department of Computer and Information Sciences Doc. Christoph Kessler TENTAMEN / EXAM TDDB68 Processprogrammering och operativsystem / Concurrent programming and operating systems TDDB72 Processprogrammering, operativsystem och realtidsystem / Concurrent programming, operating systems and real-time systems 19 dec 2005, 14:00 18:00, Jour: Christoph Kessler (070-3666687, 013-282406) Hjälpmedel / Admitted material: Engelsk ordbok / Dictionary from English to your native language; Miniräknare / Pocket calculator General instructions This exam has 7 assignments and 6 pages, including this one. Read all assignments carefully and completely before you begin. It is recommended that you use a new sheet for each assignment. Number all your sheets, and mark each sheet on top with your name, personnummer, and the course code. You may answer in either English or Swedish. Write clearly. Unreadable text will be ignored. Be precise in your statements. Unprecise formulations may lead to a reduction of points. Motivate clearly all statements and reasoning. Explain calculations and solution procedures. The assignments are not ordered according to difficulty. The exam is designed for 40 points. You may thus plan about 5 minutes per point. Grading: U, 3, 4, 5. The preliminary threshold for grade 3 is 20 points. 1

OBS C:are antagna före 2001: Om du vill ha ditt betyg i det gamla betygsystemet (U, G, VG) skriv detta tydligt på omslaget av tentan. Annars kommer vi att använda det nya systemet (U, 3, 4, 5). 2

1. (5 p.) Processes and threads (a) Define the three terms process, kernel thread and user thread, and explain the differences between these. (2.5p) (b) We discussed different thread models with different relations between user and kernel threads. Describe the models one-to-one, many-to-one and many-to-many, and briefly explain their advantages and disadvantages. (2.5p) 2. (7 p.) Synchronization Consider the following familiar situation of a ticket-based waiting-queue management system handling a set of customers who want to access a single shared service desk. We assume that there is only one service desk, which can only serve one customer at a time, and once a customer got access to the service desk, he/she will be serviced completely. Each customer who wants to access the service desk must first get a waiting ticket from a (shared) ticket automaton. After having served a customer, the leaving customer increments a globally visible counter indicating the currently active ticket number. Only the customer whose waiting ticket number equals this counter value will be served next. The others have to wait until their ticket number becomes active. get your ticket HERE 28 27 active: 23 23 26 25 24 22 ckeller, K., Träff: Practical PRAM Programming. Wiley, 2001. This analogy can be used to guide the implementation of so-called fair locks that can be used instead of ordinary locks to guard a critical section, providing mutually exclusive access to a shared resource while guaranteeing servicing incoming access requests in FIFO resp. FCFS (first come, first served) order. As you may guess, the customers correspond to threads, and the service desk to a shared resource in a computer system. (a) Sketch a realization of this mechanism based on two shared counters, such as shared unsigned int ticket; /* next ticket to be given out */ shared unsigned int active; /* the currently active ticket */ that are initially 0 and incremented according to the scenario above. Write pseudocode (routines) to get a new waiting ticket, to wait for the own ticket number to appear on the active counter, and to advance the active counter. (The shared resource itself needs not be coded explicitly). Identify the critical sections in your code. (You may assume for simplicity that a read to an unsigned integer word is an atomic operation.) (2p) 3

(b) The classical counting semaphore construct with wait() and signal() (or P() and V()) operations, as presented in the lectures and the course book, is based on an integer counter and provides mutual exclusion, but is not immediatelyapplicable to model the counters above. Why not? (1p) (c) Write a monitor solution such that critical sections are protected. (Use pseudocode notation with appropriate keywords to identify the monitorcomponents, and explain your code. The shared resource needs not be coded explicitly.) (2.5p) (d) Assume that the system supports at most P = 100 threads that can access this shared resource. (Note that then there can be at most 100 consecutive tickets given out at any time.) Design a suitable set of condition variables (how many do you need?) for your monitor solution above that wakes up a thread exactly when its ticket is about to be called up, and extend your monitor solution above to use the condition variables accordingly. (1.5p) (e) Bonus question: Certain multiprocessors provide an atomic fetch-and-increment instruction, whose semantics is defined by the following pseudocode routine: unsigned int FetchAndIncr ( shared unsigned int *ps ) f unsigned int ret; g ret = *ps; (*ps)++; return ret; atomic (1 instruction) Assume that, thanks to hardware support, any number of FetchAndIncr accesses (even to the same shared memory location) can execute simultaneously. Suggest how to use the FetchAndIncr instruction to implement a fair lock. What is the advantage of this solution over the monitor solution of question 2c? (+1p) 3. (7 p.) CPU Scheduling (a) Given a single-cpu system and the following set of processes with arrival times (in milliseconds), expected maximum execution time (ms), and priority (1 is highest, 4 is lowest priority). Process Arrival time Execution time Priority (as applicable) P 1 0 7 3 P 2 2 4 2 P 3 3 5 1 P 4 5 2 4 For each of the following scheduling algorithms, create a Gantt chart (time bar diagram, starting at t =0) that shows when the processes will execute on the CPU. Where applicable, the time quantum will be 3 ms. (5p) (i) FIFO; (ii) Round-robin; (iii) Shortest Job First without preemption; (iv) Priority Scheduling without preemption. (v) Priority Scheduling with preemption. 4

(b) What is a Multilevel-Feedback-Queue scheduler? Describe how it works and the reasons for using such a scheduler in a general-purpose operating system. (2p) 4. (6 p.) Deadlocks (a) There are four conditions that must hold for a deadlock to become possible. Name and describe them briefly. (2p) (b) You are given a system with 3 types of resources, A, B and C. There are 3 instances of A, 5 instances of B and 6 instances of C. Currently, 4 processes P 1...P 4 are running, and for each process, the resources currently held and its total maximum resource need for each type are given as follows: Process Already held Maximum total need ABC ABC P 1 120 223 P 2 011 024 P 3 102 222 P 4 002 104 (i) Show that the system is currently in a safe state (calculation). (1.5p) (ii) Process P 2 now asks for 1 instance of B and1ofc. Can the request be granted? Why or why not? (1.5p) (c) Current operating systems do not implement the Banker s algorithm for deadlock avoidance but instead shift this task to the application programmer. What limitation of the Banker s algorithm is the main reason for this? (1p) 5. (8 p.) Memory management (a) What is a translation lookaside buffer (TLB), and what is its purpose in the context of a paged memory system? Draw a diagram and explain in detail how the TLB works. (3p) (b) What is virtual memory with demand paging and how does it work? What are its advantages and disadvantages? (3p) (c) Describe the principle of segmentation. Why would one prefer a segmented memory model instead of a paged memory model? (2p) 6. (2 p.) Disk I/O (a) What is the purpose of disk scheduling? (1p) (b) Name and describe one disk scheduling algorithm of your choice. (1p) 7. (5 p.) Protection and Security (a) What is a buffer-overflow attack? Describe the vulnerability, the factors that contribute to it, and give a scenario of how it can be exploited by an attacker to hijack the control of a running server program. (3p) (b) Suggest at least one (software or hardware) measure to prevent such buffer-overflow vulnerabilities. Explain briefly how it works. (1p) 5

Good luck! (c) Initially, the UNIX password file /etc/passwd used to be readable for all users, but in more recent versions it can only be read by the system administrator, due to security concerns. Why? (1p) 6