SOLUTIONS FOR THE FIRST 4330 QUIZ Jehan-François Pâris Spring 2015.

Slides:



Advertisements
Similar presentations
More on Processes Chapter 3. Process image _the physical representation of a process in the OS _an address space consisting of code, data and stack segments.
Advertisements

Chapter 3 Process Description and Control
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.
A. Frank - P. Weisberg Operating Systems Process Scheduling and Switching.
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.
3.5 Interprocess Communication Many operating systems provide mechanisms for interprocess communication (IPC) –Processes must communicate with one another.
3.5 Interprocess Communication
1/28/2004CSCI 315 Operating Systems Design1 Operating System Structures & Processes Notice: The slides for this lecture have been largely based on those.
1 An Architectural View of an OS Inter-process communication Process Scheduling Process Control Subsystem File Subsystem Device Drivers Hardware Control.
Real-Time Kernels and Operating Systems. Operating System: Software that coordinates multiple tasks in processor, including peripheral interfacing Types.
UNIX Process Creation Every process, except process 0, is created by the fork() system call fork() allocates entry in process table and assigns a unique.
1 Process Description and Control Chapter 3 = Why process? = What is a process? = How to represent processes? = How to control processes?
Threads CS 416: Operating Systems Design, Spring 2001 Department of Computer Science Rutgers University
Process Description and Control A process is sometimes called a task, it is a program in execution.
1 Threads Chapter 4 Reading: 4.1,4.4, Process Characteristics l Unit of resource ownership - process is allocated: n a virtual address space to.
Phones OFF Please Processes Parminder Singh Kang Home:
BINA RAMAMURTHY UNIVERSITY AT BUFFALO System Structure and Process Model 5/30/2013 Amrita-UB-MSES
1 Lecture 4: Threads Operating System Fall Contents Overview: Processes & Threads Benefits of Threads Thread State and Operations User Thread.
Solutions to the first midterm COSC 4330/6310 Summer 2012.
Operating System 4 THREADS, SMP AND MICROKERNELS
1 Previous lecture review n Out of basic scheduling techniques none is a clear winner: u FCFS - simple but unfair u RR - more overhead than FCFS may not.
Solutions to the first midterm COSC 4330/6310 Summer 2013.
Chapter 41 Processes Chapter 4. 2 Processes  Multiprogramming operating systems are built around the concept of process (also called task).  A process.
Recall: Three I/O Methods Synchronous: Wait for I/O operation to complete. Asynchronous: Post I/O request and switch to other work. DMA (Direct Memory.
Processes and Threads CS550 Operating Systems. Processes and Threads These exist only at execution time They have fast state changes -> in memory and.
Computer Architecture and Operating Systems CS 3230: Operating System Section Lecture OS-1 Process Concepts Department of Computer Science and Software.
 2004 Deitel & Associates, Inc. All rights reserved. 1 Chapter 4 – Thread Concepts Outline 4.1 Introduction 4.2Definition of Thread 4.3Motivation for.
Threads G.Anuradha (Reference : William Stallings)
Copyright ©: University of Illinois CS 241 Staff1 Threads Systems Concepts.
CS333 Intro to Operating Systems Jonathan Walpole.
ITFN 3601 Introduction to Operating Systems Lecture 3 Processes, Threads & Scheduling Intro.
Operating System Structure A key concept of operating systems is multiprogramming. –Goal of multiprogramming is to efficiently utilize all of the computing.
Concurrency & Context Switching Process Control Block What's in it and why? How is it used? Who sees it? 5 State Process Model State Labels. Causes of.
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.
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.
CSC 322 Operating Systems Concepts Lecture - 7: by Ahmed Mumtaz Mustehsan Special Thanks To: Tanenbaum, Modern Operating Systems 3 e, (c) 2008 Prentice-Hall,
Cs431-cotter1 Processes and Threads Tanenbaum 2.1, 2.2 Crowley Chapters 3, 5 Stallings Chapter 3, 4 Silberschaz & Galvin 3, 4.
Chapter 3: Processes. 3.2 Silberschatz, Galvin and Gagne ©2005 Operating System Concepts - 7 th Edition, Feb 7, 2006 Chapter 3: Processes Process Concept.
Introduction Contain two or more CPU share common memory and peripherals. Provide greater system throughput. Multiple processor executing simultaneous.
I/O Software CS 537 – Introduction to Operating Systems.
Process Control Management Prepared by: Dhason Operating Systems.
S ALVATORE DI G IROLAMO (TA) Networks and Operating Systems: Exercise Session 1.
1 Module 3: Processes Reading: Chapter Next Module: –Inter-process Communication –Process Scheduling –Reading: Chapter 4.5, 6.1 – 6.3.
Threads prepared and instructed by Shmuel Wimer Eng. Faculty, Bar-Ilan University 1July 2016Processes.
Processes and Threads Chapter 3 and 4 Operating Systems: Internals and Design Principles, 6/E William Stallings Patricia Roy Manatee Community College,
Computer System Structures
Chapter 4 – Thread Concepts
CS 6560: Operating Systems Design
Chapter 4 – Thread Concepts
Process Management Presented By Aditya Gupta Assistant Professor
Operating Systems Threads.
System Structure and Process Model
Chapter 3: Processes.
System Structure and Process Model
CGS 3763 Operating Systems Concepts Spring 2013
System Structure B. Ramamurthy.
ICS 143 Principles of Operating Systems
CS 143A Quiz 1 Solution.
System Structure and Process Model
Operating Systems Chapter 5: Input/Output Management
Process & its States Lecture 5.
Mid Term review CSC345.
Process Description and Control
Threads Chapter 4.
Chapter 2 Processes and Threads 2.1 Processes 2.2 Threads
Jonathan Walpole Computer Science Portland State University
Prof. Leonardo Mostarda University of Camerino
CS510 Operating System Foundations
Presentation transcript:

SOLUTIONS FOR THE FIRST 4330 QUIZ Jehan-François Pâris Spring 2015

Advantages and disadvantages Match each of the following advantages or disadvantages with the single sentence that describes it best:  Hint: Several of the choices offered are plain wrong

Advantages and disadvantages Main disadvantage of delayed writes

Advantages and disadvantages Main disadvantage of delayed writes  Will result in a data loss if the system crashes at the wrong time.

Advantages and disadvantages Main advantage of dual-mode CPUs

Advantages and disadvantages Main advantage of dual-mode CPUs  Prevent user processes from directly accessing disk drives and other peripherals

Advantages and disadvantages Main advantage of timer interrupts

Advantages and disadvantages Main advantage of timer interrupts  Prevent user processes from monopolizing a CPU core

Advantages and disadvantages Main advantage of DMA controllers

Advantages and disadvantages Main advantage of DMA controllers  Speed up data transfers between the disk drive and the main memory  On the other hand, they do not provide user processes with direct access to disk drives and other peripherals Would be very bad!

Advantages and disadvantages Main advantage of lightweight processes

Advantages and disadvantages Main advantage of lightweight processes  Are much cheaper to create than conventional processes

Advantages and disadvantages Main disadvantage of microkernels

Advantages and disadvantages Main disadvantage of microkernels Introduce additional context switch delays in the processing of requests

Advantages and disadvantages Main advantage of modular kernels

Advantages and disadvantages Main advantage of modular kernels  Let users add new features to the kernel

Advantages and disadvantages Main disadvantage of modular kernels

Advantages and disadvantages Main disadvantage of modular kernels  Increase the risk of system crashes

Advantages and disadvantages Main advantage of time sharing

Advantages and disadvantages Main advantage of time sharing  Allows multiple interactive users to share the same computer

Advantages and disadvantages Main advantage of multi-threaded servers

Advantages and disadvantages Main advantage of multi-threaded servers  Can process multiple client requests in parallel

Questions with short answers How can we prevent processes from accessing the address spaces of other processes? How can we prevent user processes from tampering with the kernel?

Questions with short answers How can we prevent processes from accessing the address spaces of other processes? How can we prevent user processes from tampering with the kernel?  By adding memory protection.

Questions with short answers In a dual-mode CPU, how can the CPU switch from user mode to privileged mode?

Questions with short answers In a dual-mode CPU, how can the CPU switch from user mode to privileged mode?  When it processes an interrupt (as the interrupt will leave the program counter in a safe location INSIDE the kernel.)

Questions with short answers What is the main difference between real-time applications with hard and soft deadlines?

Questions with short answers What is the main difference between real-time applications with hard and soft deadlines?  Missing a hard deadline can have catastrophic consequences while missing a soft deadline is a mere inconvenience

Questions with short answers What would have happened if Unix had remained written in assembly language?

Questions with short answers What would have happened if Unix had remained written in assembly language?  It would not have been ported to other architectures and would NOT have had the same impact

Questions with short answers Why is fork( ) one of the costliest system calls?

Questions with short answers Why is fork( ) one of the costliest system calls?  Because it requires making a copy of the address space of the forking process

Questions with short answers In which state is a process performing a disk I/O?

Questions with short answers In which state is a process performing a disk I/O?  In the WAITING STATE

Questions with short answers In which state is a process waiting for a core?  In the READY STATE

I/O Redirection How would you let a program read its standard input from the file input.txt?  fh = open("data.txt", O_RDONLY); ______ ______ close(fh);

I/O Redirection How would you let a program read its standard input from the file input.txt?  fh = open("data.txt", O_RDONLY); close(0)// Close stdio ______ close(fh);

I/O Redirection How would you let a program read its standard input from the file input.txt?  fh = open("data.txt", O_RDONLY); close(0)// Close stdio dup(fh)// Duplicate fh into stdio close(fh);

Parent and child processes Add the two system calls that will ensure that the program will print exactly once Hello World! and Goodbye! in that order. (2×5 points)

Parent and child processes int main(){ if (fork() == 0) { printf("Hello World!\n"); ______ } ______ printf("Goodbye!\n") } // main

Parent and child processes int main(){ if (fork() == 0) { printf("Hello World!\n"); _exit(0); // Terminate child process } ______ printf("Goodbye!\n") } // main

Parent and child processes int main(){ if (fork() == 0) { printf("Hello World!\n"); _exit(0); // Terminate child process } wait(0); // Forces parent to wait printf("Goodbye!\n") } // main

Unix signals What is the default action that a Unix process takes when it receives a signal? What can it do to prevent that from happening? Is this always possible?

Unix signals What is the default action that a Unix process takes when it receives a signal?  The process terminates What can it do to prevent that from happening? Is this always possible?

Unix signals What is the default action that a Unix process takes when it receives a signal?  The process terminates What can it do to prevent that from happening?  The process can catch the signal Is this always possible?

Unix signals What is the default action that a Unix process takes when it receives a signal?  The process terminates What can it do to prevent that from happening?  The process can catch the signal Is this always possible?  NO, the SIGKIL signal cannot be caught  NO, signal number nine cannot be caught

Process state transitions Which events will bring a RUNNING process into the WAITING state?

Process state transitions Which events will bring a RUNNING process into the WAITING state?  The process issues a (blocking) system request

Process state transitions Which events will bring a WAITING process into the READY queue?

Process state transitions Which events will bring a WAITING process into the READY queue?  The completion of a pending system request