Operating System Slide Questions

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

What are the two major functions of Operating System in Computer System?

- Control of application, utilizing hardware resources - Provide an interface for the users

Kernel mode vs Super user

- Kernel mode: allow executing codes to have direct access to all hardware/memory in OS - Super user: a root/administrative user who has all the permissions to execute programs in OS

What is a context switch? In a multitasking operating system, under what circumstances will a context switch occur?

- Moving a process in or out of Running state then saving/restoring all processor-specific registers and other process information - ???

System Calls

- OS is trusted; user is not - OS has super-privileges; user does not - Must take measures to prevent abuse

What is a system call? Describe the mechanism how an OS handle a system call?

- Request by a user-level process to call a function in the kernel - 1) System calls provided by OS are requested by putting the parameters in registers/stacks, 2) Execute a trap instruction to switch from user mode to kernel mode, transfer control to OS, 3) OS examines the parameters of the call to determine which system call to be carried out, 4) OS invoke the system call, 5) System call finished and control is given back to user program

Multiprogramming

A computer running more than one program at a time

Multitasking

A logical extension of multiprogramming; Tasks sharing a common resource, such as 1 CPU

What is Operating System?

A program that can control execution of application program, provides interface to hardware

Function Calls

Caller and callee are in the same Process - Same user - Same "domain of trust"

What are the tools you need to compile a program?

Compiler --> Assembler --> Linker --> Loader

Multiprocessing

Computer using more than one CPU at a time

In batch systems, each job must completely finish before the next job may begin.

False

What is the difference between a mutex and a semaphore?

For semaphore, its possible for others to release resources mutex has no counter

What reasons cause a process enter the kernel mode from the user mode?

Interrupts, Exceptions, System calls, Divide by 0, hardware request, etc.

In UNIX, Processes may be either in the user mode or in the kernel mode. What are the differences between these two modes? How about sudo mode?

Kernel can freely use all hardware resources, User mode cannot. Sudo mode is a type of User Mode

Which one would you use to protect access to an increment operation?

Mutex, because mutex has ownership

The enter_CS() and leave_CS() functions to implement critical section (CS) of a process are realized using test-and-set instruction. In this solution, X is a memory location associated with the CS and is initialized to 0. void enter_CS(X) { while test-and-set(X); } void leave_CS(X) { X = 0; } Can more than one process enter CS at the same time?

No

The following pseudocode illustrates a method of implementing mutual exclusion. The strategy uses the shared variable "lock" which is initially set to 0. While(lock); lock = 1; <Critical Section> lock = 0; Is the method correct?

No, violate mutual exclusive property

Distributed Operating System Pros and Cons Examples

Pros: 1. Quicker Response 2. Failure of one will not affect the other 3. Resources are being shared, computation is highly fast and durable 4. Reduce host computer loading 5. Easily scalable Cons: 1. Highly complex and not easily understood 2. Failure of the main network will stop the entire communication 3. Need to define protocol and language Example: A TACC Supercomputer

Time-Sharing Operating System Pros and Cons Examples

Pros: 1. Reduce response/CPU idle time 2. Each task get an equal opportunity 3. Avoid duplication of software Cons: 1. Reliability problem 2. Question of security and integrity of user programs and data 3. Problem of data communication. Example: UNIX

Batch Operating System Pros and Cons Examples

Pros: 1. Takes much of the work of the operator to the computer. 2. Without any manual intervention Cons: 1. Difficult to debug program. 2. A job could enter an infinite loop 3. Lack of protection scheme 4. CPU is often idle Example: 390 IBM mainframe computers

What is kernel?

The core of every OS, connecting applications to the actual processing of data.

Descript a conceptual view of a computer system.

User --> Application program --> OS --> Hardware

Switching between which of these entities is the most expensive? a. Processes b. User-level threads c. Kernel-level threads

a. Processes

When a process is waiting for CPU, what is its process state? a. Ready b. Running c. Blocked d. Zombie e. Exited

a. Ready

Which of the following instructions should only be allowed in kernel mode, and why? a. Set the time of day b. Disable all interrupts c. Read the time of day clock d. Change the memory map e. Change to the user mode

a. Set the time of day (depends) b. Disable all interrupts d. Change the memory map e. Change to the user mode

What creates a process? a. fork() b. execve() c. both

a. fork()

What are the advantages of user-level thread? a. Implemented by OS b. OS doesn't recognize user-level thread c. Spend more context switch time d. If one user-level thread perform blocking operating, then another thread can continue execution

b. OS doesn't recognize user-level thread

If you have a binary semaphore, how many potential values does it have? a. 0 b. 1 c. 2 d. 3 e. 4

c. 2

Which of the following information is normally not included in the Process control block (PCB)? a. Process Number b. CPU registers c. I/O device queues d. CPU-scheduling information e. Memory-management information

c. I/O device queues

Threads have their own ... ? a. Address Space b. PCB c. Stack

c. Stack

Termination of the process terminates a. first thread of the process b. first two threads of the process c. all threads within the process d. no thread within the process

c. all threads within the process

Every monitor function should begin with what command? a. wait() b. signal() c. lock->acquire() d. lock->release() e. broadcast()

c. lock->acquire()

The interrupt vector is used to determine the action taken by the OS when: a. An exception occurs b. An interrupt occurs c. A system call is executed d. All of the above e. None of the above

d. All of the above

List the sequences of the implementations of the create-new-process mechanism a. Parent and children share all variables b. Children share only a subset of parents' variables c. Parent stops executing until children are done d. Parents and children share no common resources e. Parents continues executing

e. Parents continues executing c. Parents stops executing until children are done a. Parent and children share all variables b. Children share only a subset of parents' variables d. Parents and children share no common resources


Kaugnay na mga set ng pag-aaral

Mastering A&P (MAP) Chapter 4 -- tissues

View Set

MICRO: CH. 13 Monopolistic Competition Part I

View Set

FINN 3120 Chapter 11: Reading Questions

View Set