Universidad Carlos III de Madrid Computer Science and Engineering Department Operating Systems Course

Similar documents
Universidad Carlos III de Madrid Computer Science and Engineering Department Operating Systems Course

Exam Guide COMPSCI 386

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

(In columns, of course.)

Processes. OS Structure. OS Structure. Modes of Execution. Typical Functions of an OS Kernel. Non-Kernel OS. COMP755 Advanced Operating Systems

CSC 4320 Test 1 Spring 2017

ECE 550D Fundamentals of Computer Systems and Engineering. Fall 2017

ENGR 3950U / CSCI 3020U Midterm Exam SOLUTIONS, Fall 2012 SOLUTIONS

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

1995 Paper 10 Question 7

CSE 410: Computer Systems Spring Processes. John Zahorjan Allen Center 534

Parallel Programming Languages COMP360

Final Exam Preparation Questions

CPSC/ECE 3220 Fall 2017 Exam Give the definition (note: not the roles) for an operating system as stated in the textbook. (2 pts.

File System Implementation. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

PROCESS CONCEPTS. Process Concept Relationship to a Program What is a Process? Process Lifecycle Process Management Inter-Process Communication 2.

csci3411: Operating Systems

Contents. PA1 review and introduction to PA2. IPC (Inter-Process Communication) Exercise. I/O redirection Pipes FIFOs

Problem Set 2. CS347: Operating Systems

Processes. Process Management Chapter 3. When does a process gets created? When does a process gets terminated?

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

File System Implementation

CS 326: Operating Systems. Process Execution. Lecture 5

ADVANCED OPERATING SYSTEMS

Fall 2015 COMP Operating Systems. Lab #3

THE PROCESS ABSTRACTION. CS124 Operating Systems Winter , Lecture 7

Lecture Topics. Announcements. Today: Threads (Stallings, chapter , 4.6) Next: Concurrency (Stallings, chapter , 5.

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CSE 451: Operating Systems Winter Module 4 Processes. Mark Zbikowski Allen Center 476

Processes. CS439: Principles of Computer Systems January 30, 2019

FILE SYSTEMS. CS124 Operating Systems Winter , Lecture 23

Outline. CS4254 Computer Network Architecture and Programming. Introduction 2/4. Introduction 1/4. Dr. Ayman A. Abdel-Hamid.

1. [Lock, Monitor and Deadlock: 5 Lectures (=26%)] 16 Marks [ ]

CS2028 -UNIX INTERNALS

Mon Sep 17, 2007 Lecture 3: Process Management

Introduction to OS. File Management. MOS Ch. 4. Mahmoud El-Gayyar. Mahmoud El-Gayyar / Introduction to OS 1

Computer Systems II. First Two Major Computer System Evolution Steps

Che-Wei Chang Department of Computer Science and Information Engineering, Chang Gung University

CROWDMARK. Examination Midterm. Spring 2017 CS 350. Closed Book. Page 1 of 30. University of Waterloo CS350 Midterm Examination.

EECE.4810/EECE.5730: Operating Systems Spring 2017 Homework 2 Solution

Windows 7 Overview. Windows 7. Objectives. The History of Windows. CS140M Fall Lake 1

Final Exam. 12 December 2018, 120 minutes, 26 questions, 100 points

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

AC72/AT72/AC117/AT117 LINUX INTERNALS DEC 2015

Deadlock. Concurrency: Deadlock and Starvation. Reusable Resources

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

Chapter 1 Introduction

Pipes and FIFOs. Woo-Yeong Jeong Computer Systems Laboratory Sungkyunkwan University

(MCQZ-CS604 Operating Systems)

FILE SYSTEM IMPLEMENTATION. Sunu Wibirama

Processes The Process Model. Chapter 2 Processes and Threads. Process Termination. Process States (1) Process Hierarchies

Processes. CS439: Principles of Computer Systems January 24, 2018

Operating Systems Design Exam 2 Review: Fall 2010

Process management. What s in a process? What is a process? The OS s process namespace. A process s address space (idealized)

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

Dealing with Issues for Interprocess Communication

* What are the different states for a task in an OS?


Introduction to OS Processes in Unix, Linux, and Windows MOS 2.1 Mahmoud El-Gayyar

The Operating System Machine Level

TDDB68 Concurrent Programming and Operating Systems. Lecture: File systems

Recap: Thread. What is it? What does it need (thread private)? What for? How to implement? Independent flow of control. Stack

Operating Systems Design Fall 2010 Exam 1 Review. Paul Krzyzanowski

Introduction. Yolanda Becerra Fontal Juan José Costa Prats

Processes. Sanzheng Qiao. December, Department of Computing and Software

OPERATING SYSTEMS, ASSIGNMENT 4 FILE SYSTEM

C13: Files and Directories: System s Perspective

CPS 310 first midterm exam, 2/26/2014

File System Implementation. Sunu Wibirama

There is a general need for long-term and shared data storage: Files meet these requirements The file manager or file system within the OS

File Systems. File system interface (logical view) File system implementation (physical view)

CS 333 Introduction to Operating Systems. Class 3 Threads & Concurrency. Jonathan Walpole Computer Science Portland State University

makes floppy bootable o next comes root directory file information ATTRIB command used to modify name

Operating Systems CMPSCI 377 Spring Mark Corner University of Massachusetts Amherst

stack Two-dimensional logical addresses Fixed Allocation Binary Page Table

Contents. IPC (Inter-Process Communication) Representation of open files in kernel I/O redirection Anonymous Pipe Named Pipe (FIFO)

Operating Systems, Final exam May 2016 Bachelor's Degree in Computer Science and Engineering

REVIEW OF COMMONLY USED DATA STRUCTURES IN OS

Chapter 11: Implementing File Systems. Operating System Concepts 8 th Edition,

Mid Term from Feb-2005 to Nov 2012 CS604- Operating System

ECE 3055: Final Exam

!! How is a thread different from a process? !! Why are threads useful? !! How can POSIX threads be useful?

CS510 Operating System Foundations. Jonathan Walpole

CSE Traditional Operating Systems deal with typical system software designed to be:

2 nd Half. Memory management Disk management Network and Security Virtual machine

File System CS170 Discussion Week 9. *Some slides taken from TextBook Author s Presentation

File System Case Studies. Jin-Soo Kim Computer Systems Laboratory Sungkyunkwan University

CHAPTER 11: IMPLEMENTING FILE SYSTEMS (COMPACT) By I-Chen Lin Textbook: Operating System Concepts 9th Ed.

PROCESS STATES AND TRANSITIONS:

MARUTHI SCHOOL OF BANKING (MSB)

Long-term Information Storage Must store large amounts of data Information stored must survive the termination of the process using it Multiple proces

Chapter 4. File Systems. Part 1

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

CS 5460/6460 Operating Systems

File Systems Management and Examples

Creating a Shell or Command Interperter Program CSCI411 Lab

File Systems. CS 4410 Operating Systems. [R. Agarwal, L. Alvisi, A. Bracy, M. George, E. Sirer, R. Van Renesse]

Physical memory vs. Logical memory Process address space Addresses assignment to processes Operating system tasks Hardware support CONCEPTS 3.

Operating Systems. Sina Meraji U of T

Transcription:

Exercise 1 (20 points). Autotest. Answer the quiz questions in the following table. Write the correct answer with its corresponding letter. For each 3 wrong answer, one correct answer will be subtracted as penalty. Nonanswered questions do not produce any penalty. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1. Which of the following alternatives has a page table with a size related to the physical memory? A) Two-level page table scheme B) Hashed page table C) Inverted page table D) None of these alternatives 2. Which are Readers-Writers problem conditions? A) Any number of readers may read from data area concurrently. B) Only a writer may modify information at once. C) During a write no reader may perform a request. D) All of the above. 3. Which kind of fragmentations might occur in paging and segmentation? A) In segmentation we might have internal fragmentation while in paging external fragmentation. B) In segmentation we might have external fragmentation while in paging internal fragmentation. C) We can have both internal and external fragmentation in paging but only internal in segmentation. D) We can have both internal and external fragmentation in segmentation but only internal in paging. 4. Choose the INCORRECT answer: In a mutex... A) lock(m) tries to block the mutex. If it is already locked, lock(m) unlocks it B) unlock(m) unblocks the mutex. If there are processes blocked in the mutex, one or several ones are unblocked C) lock(m) tries to block the mutex. If it is already locked, the calling thread is blocked D) lock(m) and unlock(m) are the only atomic operations for a mutex 5. In the concurrent use of files, the UNIX semantics specifies that: A) Each process uses a non-visible private copy that is not visible by the other processes. B) Each write produces a new file version. C) Concurrent file reads are the only allowed operations D) The file position pointer is not shared between processes. 6. The memory management unit (MMU)... 1

A) Is a hardware device that maps physical to virtual memory B) Provides hardware support to the OS memory management C) Is a component present only in Unix like systems D) None of the answers is correct 7. Select the correct answer, when a process is duplicated (fork): A) It duplicates open files table B) Shares intermediate table with i-nodes and positions C) A and B are correct D) A and B are incorrect 8. The process environment: A) There is not process environment but command shell environment. B) It is local the process and placed in the process stack. C) It defines the hardware context where the process is being executed. D) Defines if a process is environmentally friendly 9. The bit of user/kernel modes: A) Is provided by the operating system B) Provides the ability to distinguish when a process can run privileged instructions. C) Is changed only at the startup of the system D) None of the previous answers are correct 10. SIGILL, SIGALRM and SIGKILL are examples of a basic element in inter-process communication, which one? A) Exceptions B) Timers C) Signals D) Pipes 11. For the fork() system call in Linux, which of the following is true? A) The fork() process takes in an argument and returns a process ID. C) A child process is created but it does not execute the fork() function. D) When fork() is executed, an identical copy of its address space is created as well as its PCB. 12. Assume that we use the UNIX link service: int link(const char *existing, const char *new); Now, to link the file prueba.txt that is in /system with a file with the same name located in /users. Then: A) It is not possible to link two files with the same name. B) There are two files, remaining one as the original in /system and other, as the linked one in /users. C) There are two files, but they are indistinguishable because the OS does not record which one is the original one and which is the linked one. D) It is only possible to link directories. 2

13. An operating system is activated in response to: A) A service request from a process B) An interrupt from a peripheral C) A hardware exception D) All the above. 14. Search time corresponds to: A) The time taken for the replacement algorithm to select a page when a page fault occurs. B) The time it takes to transfer data on a disk. C) The average time it takes for the sector to be under the read / write disk. D) The time required for the disk heads to move to the appropriate cylinder. 15. When the software relocation of the memory addresses is being used: A) The program or a program fragment can be relocated at runtime. B) The protection between different processes is guaranteed. C) The program code in memory has independent logical space. D) All the answers are wrong. 3

Exercise 2 (30 points) Write a C program that creates the following processes: Parent Child1 ------> Child2 pipe Child 1 will read data form keyboard and will send it to Child2 through a pipe. Child2 displays the received message on the screen. The process execution will conclude when the Child1 receives the string "exit". Exercise 3. (30 points) Given a Producer-Consumer system where the producer generates information and increments a message counter. The consumer collects this information and then broadcast it and decrements the message counter. The processes do not interact with each other, except for control purposes. There are no mechanisms to store the produced information, thus it should be ensured strict alternation in the system. That is, when a producer generates information, it must wait until it has been collected by the Consumer before producing new information. The processes are coded according to the following pseudocode: procedure Producer is while (true) do generate_and_store; increase; end while; end procedure; procedure Consumer is while (true) do get_and_send; decrease; end while; end procedure; Increase and decrease operations are atomic and operate on the same variable. 4

Answer the following questions: Universidad Carlos III de Madrid 1. Modify the provided code to ensure strict alternation between producer and consumer processes. You can use semaphores and the generic wait and signal instructions. 2. In a second step, you have to modify the solutions to allow the producer to store messages and wait with them until the Consumer collects them. If there are producer and consumer processes waiting for being executed, the system must keep the strict alternation between them. Otherwise, the producer can pass its turn to another Producer process. Write the code implementation using shared integer variables and semaphores. Exercise 4. (20 points) Given the following small-size linked file system based on the File-Allocation Table (FAT): Block size: 1KB. The first 10 blocks (0 through 9) are reserved for filesystem, of which 3 are used to store filesystem information (SuperBlock) and for the filesystem boot (Boot). The remaining 7 blocks are used to store information of directories. The information of each directory occupies a block. Each entry has the following fields: filename extension with 64 bytes; metadata (user name, permissions, etc.) with 63 bytes; and starting block with 1 byte. A directory does not contain directories. Initially, the file system has two directories named (/documents and / bin) whose content is shown below: Directory: /documents Config.cf Doc.txt Metadata Metadata 18 11 Directory: /bin ls ps cd gcc Metadata Metadata Metadata Metadata 38 25 17 13 5

The FAT table only stores information related to the file data. The value -1 is used to encode the end of the file and 0 to indicate that the block is free. Below, the contents of the entire file system FAT table are shown. The upper index is the block number. The free block allocation policy for a new file is to first allocate the free blocks with the lowest identifier. FAT TABLE 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24-1 15 0-1 0 29 0 20-1 0 33 0 0 37 0 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 23 0 0 0 10 0-1 0-1 0 31 0 35-1 0 Considering this file system, answer the following questions. Justify your answer. 1. What is the total filesystem size? What is the filesystem effective capacity (the space in bytes that can be used to store file data)? 2. What is the maximum number of directories that the filesystem supports? How many files can be in each directory? 3. What are the files stored in the /bin directory? Briefly describes the functionality of each one of them. 4. Explain what blocks are uses to store information for the file /document/doc.txt. For the same file: In which block is the file data byte 2050 stored? 5. Show the changes in the file system that would involve creating a new file, named test.txt, with a size of 3 blocks in the /documents directory. 6. An important factor to improve the filesystem performance is to minimize the number of accesses to the filesystem data structures. This allows to reduce time while locating a particular data block. What are the drawbacks of this type of filesystem when accessing large files randomly (that is, not sequentially)? Do index-based files systems (such as UNIX-based i-nodes) have the same drawbacks? 6