Solutions to the first midterm COSC 4330/6310 Summer 2012.

Slides:



Advertisements
Similar presentations
Lab 9 CIS 370 Umass Dartmouth.  A pipe is typically used as a one-way communications channel which couples one related process to another.  UNIX deals.
Advertisements

CAS3SH3 Midterm Review. The midterm 50 min, Friday, Feb 27 th Materials through CPU scheduling closed book, closed note Types of questions: True & False,
Tutorial 5 Test1 Review. Q1: Which of the following is an operating system theme or model as defined in lectures?
Processes and Threads Chapter Processes 2.2 Threads 2.3 Interprocess communication 2.4 Classical IPC problems 2.5 Scheduling.
Review: Chapters 1 – Chapter 1: OS is a layer between user and hardware to make life easier for user and use hardware efficiently Control program.
Thursday, June 08, 2006 The number of UNIX installations has grown to 10, with more expected. The UNIX Programmer's Manual, 2nd Edition, June, 1972.
Operating Systems High Level View Chapter 1,2. Who is the User? End Users Application Programmers System Programmers Administrators.
1 Last Time: OS & Computer Architecture Modern OS Functionality (brief review) Architecture Basics Hardware Support for OS Features.
1 Introduction Chapter What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.
Mid#1 Revision. CH1 Mind map Ch2 Mind map Types of Questions Short Answers (essay) True/False MCQ Problems Code to trace.
Operating Systems - Introduction S H Srinivasan
Figure 1.1 Interaction between applications and the operating system.
CSSE Operating Systems
Process Description and Control A process is sometimes called a task, it is a program in execution.
Chapter 1 Introduction 1.1 What is an operating system
Slide 3-1 Copyright © 2004 Pearson Education, Inc. Operating Systems: A Modern Perspective, Chapter 3 Operating System Organization.
What do operating systems do? manage processes manage memory and computer resources provide security features execute user programs make solving user.
BINA RAMAMURTHY UNIVERSITY AT BUFFALO System Structure and Process Model 5/30/2013 Amrita-UB-MSES
The Programming Interface. Main Points Creating and managing processes – fork, exec, wait Performing I/O – open, read, write, close Communicating between.
System Calls 1.
General What is an OS? What do you get when you buy an OS? What does the OS do? What are the parts of an OS? What is the kernel? What is a device.
Process Management. Processes Process Concept Process Scheduling Operations on Processes Interprocess Communication Examples of IPC Systems Communication.
Architecture Support for OS CSCI 444/544 Operating Systems Fall 2008.
Solutions to the first midterm COSC 4330/6310 Summer 2013.
Operating Systems ECE344 Ashvin Goel ECE University of Toronto OS-Related Hardware.
Chapter 1 Introduction 1.1 What is an operating system
1 Introduction Chapter What is an operating system 1.2 History of operating systems 1.3 The operating system zoo 1.4 Computer hardware review 1.5.
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
Operating Systems Lecture November 2015© Copyright Virtual University of Pakistan 2 Agenda for Today Review of previous lecture Hardware (I/O, memory,
Operating Systems Structure what is the organizational principle?
Operating Systems Process Creation
1 Computer Systems II Introduction to Processes. 2 First Two Major Computer System Evolution Steps Led to the idea of multiprogramming (multiple concurrent.
4300 Lines Added 1800 Lines Removed 1500 Lines Modified PER DAY DURING SUSE Lab.
Operating System 4 THREADS, SMP AND MICROKERNELS.
Processes, Threads, and Process States. Programs and Processes  Program: an executable file (before/after compilation)  Process: an instance of a program.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Processes and Threads.
CSE 153 Design of Operating Systems Winter 2015 Midterm Review.
Chapter 1 Introduction  What is an operating system  History of operating systems  The operating system zoo  Computer hardware review  Operating system.
What is a Process ? A program in execution.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
Processes 2 Introduction to Operating Systems: Module 4.
Concepts and Structures. Main difficulties with OS design synchronization ensure a program waiting for an I/O device receives the signal mutual exclusion.
I/O Software CS 537 – Introduction to Operating Systems.
SOLUTIONS FOR THE FIRST 4330 QUIZ Jehan-François Pâris Spring 2015.
S ALVATORE DI G IROLAMO (TA) Networks and Operating Systems: Exercise Session 1.
Chapter 3 The Programming Interface Chien-Chung Shen CIS/UD
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Operating System Components) These components reflect the services made available by the O.S. Process Management Memory Management I/O Device Management.
10/2/20161 Operating Systems Design (CS 423) Elsa L Gunter 2112 SC, UIUC Based on slides by Roy Campbell, Sam King,
Introduction to Operating Systems Concepts
Computer System Structures
Kernel Design & Implementation
CS 6560: Operating Systems Design
Protection of System Resources
UNIX PROCESSES.
KERNEL ARCHITECTURE.
System Structure and Process Model
System Structure and Process Model
System Structure B. Ramamurthy.
OPERATING SYSTEMS DESIGN AND IMPLEMENTATION Third Edition ANDREW S
ICS 143 Principles of Operating Systems
Process Models, Creation and Termination
More examples How many processes does this piece of code create?
Mid Term review CSC345.
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Operating Systems Lecture 3.
Lecture 6: Multiprogramming and Context Switching
Operating Systems: A Modern Perspective, Chapter 3
CS510 Operating System Foundations
Lab 6: Process Management
Presentation transcript:

Solutions to the first midterm COSC 4330/6310 Summer 2012

First question: True or false  Processes waiting for the CPU are in the waiting state.

First question: True or false  Processes waiting for the CPU are in the waiting state.  FALSE, they are in the ready state

First question: True or false  UNIX was the first system to be written in C.

First question: True or false  UNIX was the first system to be written in C.  TRUE, it was designed to be portable (and C was specifically written for UNIX)

First question: True or false  Memory protection is always implemented in hardware.

First question: True or false  Memory protection is always implemented in hardware.  TRUE, any other solution would be too slow

First question: True or false  execve() system calls are often followed by a fork() system call.

First question: True or false  execve() system calls are often followed by a fork() system call.  FALSE, it is the other way around: fork() system calls are often followed by an execve() system call.

First question: True or false  In a multiprogramming system, there can be many programs in the system but only one process.

First question: True or false  In a multiprogramming system, there can be many programs in the system but only one process.  FALSE, there are many processes competing for one of the CPU cores

First question: True or false  Most modern operating systems have a microkernel.

First question: True or false  Most modern operating systems have a microkernel.  FALSE, microkernels are too slow

Second question: Advantages and disadvantages  What is the major disadvantage of modular kernels over monolithic kernels?

Second question: Advantages and disadvantages  What is the major disadvantage of modular kernels over monolithic kernels?  They make the kernel less robust.

Second question: Advantages and disadvantages  What is the major advantage of modular kernels over monolithic kernels?

Second question: Advantages and disadvantages  What is the major advantage of modular kernels over monolithic kernels?  They let users add functionality to the kernels like new file systems or device drivers for new devices

Second question: Advantages and disadvantages  What is the major disadvantage of CPUs that do not have a privileged mode?

Second question: Advantages and disadvantages  What is the major disadvantage of CPUs that do not have a privileged mode?  They cannot prevent user processes from executing I/O instructions

Second question: Advantages and disadvantages  What is the major disadvantage of not having memory protection?

Second question: Advantages and disadvantages  What is the major disadvantage of not having memory protection?  We cannot prevent user processes from tampering with the kernel (and other user processes)

Second question: Advantages and disadvantages  What is the major advantage of user-level threads?

Second question: Advantages and disadvantages  What is the major advantage of user-level threads?  They are portable and can run on kernels that do not support threads.

Third question: I/O redirection  Complete the following fragment of code to ensure that the standard input of the process is redirected to the pipe mypipe.  int fd, mypipe[2]; _________________________ __________________________ close(mypipe[0]); close(mypipe[1]);

Third question: I/O redirection  Complete the following fragment of code to ensure that the standard input of the process is redirected to the pipe mypipe.  int fd, mypipe[2]; pipe(mypipe); close(0); dup(mypipe[0]; close(mypipe[0]); close(mypipe[1]);

Third question: I/O redirection  Complete the following fragment of code to ensure that the standard output of the process is redirected to the pipe mypipe.  int fd, mypipe[2]; _________________________ __________________________ close(mypipe[0]); close(mypipe[1]);

Third question: I/O redirection  Complete the following fragment of code to ensure that the standard output of the process is redirected to the pipe mypipe.  int fd, mypipe[2]; pipe(mypipe); close(1); dup(mypipe[1]; close(mypipe[0]); close(mypipe[1]);

Fourth question  How many lines of output will the following program print? (5 points) int main(){ if (fork() == 0) printf("Hello World!\n"); printf("Goodbye!\n") } // main  __________lines

Fourth question  How many lines of output will the following program print? (5 points) int main(){ if (fork() == 0) printf("Hello World!\n"); printf("Goodbye!\n") } // main  Three lines

Fifth question  Give an example of a real time process with soft deadlines.

Fifth question  Give an example of a real time process with soft deadlines.  A DVD player

Sixth question  What is happening when a UNIX process issues a wait() system call and all its child processes have already terminated?  Will the process wait forever?

Sixth question  What is happening when a UNIX process issues a wait() system call and all its child processes have already terminated?  Will the process wait forever?  NO, processes that have terminated but have not yet been waited for by their parents remain in the process table in the ZOMBIE state.  The waiting process returns immediately

Seventh question  Which UNIX system call can we use to catch signals? What does it mean? Is it always possible?

Seventh question  Which UNIX system call can we use to catch signals? What does it mean? Is it always possible?  signal(…)  signal specifies what the process should do when it receives a specific signal  No signal number 9 (SIGKIL) cannot be caught

Eighth question  Why should we prevent users of a multi- user system from rebooting the OS from their own CD-ROM?

Eighth question  Why should we prevent users of a multi- user system from rebooting the OS from their own CD-ROM?  User could reboot the system with an OS that will let do things they are not authorized to do