Midterm Study

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

Threading models:

- One-to-one *All threads can access the kernel at the same time, leading to each additional thread to add more "weight" to the process. - Many-to-one *The application can create any number of threads that can execute concurrently. -Many-to-many as called two-level model. *minimizes programming effort while reducing the cost and weight of each thread.

Why do we need to synchronize processes or threads?

-Concurrent access to shared data may result in data inconsistency. -Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating processes.

What are the advantages of multiprogramming?

-Increased CPU utilization -Increased Throughput -Shorter Turn around time -Improved Memory Utilization -Increased Resources Utilization -Multiple Users

IPC (Interprocess communication)

-Message passing and shared memory -Client-server IPC -Pipe

Why do we need to have co-operating processes or threads(instead of having them run independently)?

-Resource sharing -Speed up -Modularity

PCB (Process Control Block) - located in kernel memory

-process state is one of {new,ready,running,waiting or terminated} -program counter -cpu registers include general purpose registers content and other cpu state needed to restart a process -memory management info including base & limit regs. or page tables -accounting info: amount of CPU used, process number etc. -I/O status info including outstanding requests, devices held, open files, etc. -cpu scheduling info such as priority, queue pointers, etc.

Thread consists of:

-program counter -set of registers -stack space

Operation System Services

-program execution -I/O operations -file system manipulation -Communications -error detection( hw and sw) and these at a system level -resource allocation -accounting -protection

Three processes arriving at the same time in the order of P1, P2, P3, with CPU burst being 2ms, 10ms, and 7pm. Using FCFS CPU scheduling, what would be the total waiting time in ms? 1) 20 2) 13 3) 16 4) 3

16

CPU burst

A continuous CPU execution time

I/O burst

A continuous I/O time

Time-Sharing-System

A logical extension of multiprogramming. Allow users to share the computer simultaneously. Response time should be quick enough to provide the user impression of direct access.

Which of the following is true about I/O-bound vs. CPU-bound process: 1) I/O-bound processes never need CPU time 2) CPU-bound processes never do I/O 3) A multi-programming system prefers a mix of I/O-bound and CPU-bound processes. 4) None of the rest

A multi-programming system prefers a mix of I/O-bound and CPU-bound processes

The difference between program and process includes: 1) A process has address space but a program does not. 2) A program has state but a process does not. 3) A program has program counter but a process does not. 4) One program always corresponds to one process.

A process has address space but a program does not

What is the difference between Job and Process?

A process refers to a program under execution. This program may be an application or system program. Job means an application program and it is not a system program.

priority-inheritance protocol

A protocol for solving priority inversion in which all processes that are accessing resources needed by a higher-priority process inherit that higher priority until they are finished with the resources in question.

1. Which of the following is true about storage hierarchy: A. The upper level storage devices such as registers are usually smaller than the lower level storage such as main memory. B. The upper level storage devices such as registers are usually more expensive than the lower level storage such as main memory. C. The upper level storage devices such as registers are usually faster than the lower level storage such as main memory. D. All of the rest.

All of the rest

1. Which of the following models are possible for the relationship between the user threads and kernel threads? A. many-to-one model B. one-to-one model C. many-to-many model D. two-level model E. all of the rest

All of the rest

1. Which section is part of the layout of a process in memory: A. data. B. All of the rest. C. heap. D. stack.

All of the rest

A context switch______________________. A. can happen on either single-core or multi-core machines. B. makes multi-programming possible. C. helps create the illusion that a user has full access of the machine. D. All of the rest.

All of the rest

Which of the following is true: 1) Turnaround time is the sum of the periods that a process is spent waiting to get into memory, waiting in the ready queue, executing on the CPU, and doing I/O. 2) Turnaround time measures the amount of time it takes to execute a process. 3) Response time is a measure of the time that elapses between a request and the first response produced. 4) All of the rest.

All of the rest

Which of the following models are possible for the relationship between the user threads and kernel threads? 1) Many-to-one model 2) One-to-one model 3) Many-to-many model 4) Two-level model 5) All of the rest

All of the rest

Which section is part of the layout of process in memory: 1) Data 2) All of the rest 3) Heap 4) Stack

All of the rest

1. Which of the following statements is NOT correct about today's operating systems? A. An operating system must provide an environment for the execution of programs. B. An operating system must manage system resources. C. Any operating system must provide three types of user interfaces namely command line, graphical user interfaces and touch-screen interface. D. Operating systems must provide security.

Any operating system must provide three types of user interfaces namely command line, graphical user interfaces and touch-screen interface.

What is difference between buffer and cache?

Buffer is used to compensate for difference in speed between two processes that exchange or use data. Cache is a smaller and fastest memory component in the computer.

I/O-bound program typically has many short _____ and a CPU-bound program might have a few long _______. 1) I/O burst, CPU burst 2) I/O burst, I/O burst 3) CPU burst, CPU burst 4) CPU burst, I/O burst

CPU burst, CPU burst

Clustered Systems

Clustering allows two or more individual systems to share storage. Provides high availability. Asymmetric clustering: one server runs the application while other servers standby. Symmetric clustering: all N hosts are running the application.

Which of the following items are shared across multiple threads belonging to the same process? 1) Code, data, files 2) Registers 3) Stack 4) All of the rest

Code, data, files

Concurrency vs Parallelism

Concurrency: interleaving of processes in time to give the appearance of simultaneous execution. Parallelism: genuine simultaneous execution.

Preemptive scheduling

Consider interrupts occuring during crucial OS activities Concurrency issues at user level and kernel design Consider access to shared data; Any scheduling that does not include terminated or going from running to waiting.

Which of the following is NOT one of the major category of system calls? 1) Process management 2) Cyber security 3) File management 4) Device control

Cyber Security

Which of the following scheduling algorithms must be nonpreemptive? 1) SJF 2) RR 3) FCFS 4) Priority algorithms

FCFS

1. As computers and operating systems evolve over the years, people-per-computer (number of people divided by number of computers) has been increasing. A. True B. False

False

1. The bootstrap program resides entirely in main memory (RAM). A. True B. False

False

Although some CPU scheduling criteria are not compatible, minimizing turnaround time guarantees minimizing response time. 1) True 2) False

False

As computers and operating systems evolve over the years, people-per-computer (number of people divided by number of computers) has been increasing 1) True 2) False

False

For the round-robin scheduling algorithm, it is guaranteed that the larger the quantum, the smaller the average waiting time. 1) True 2) False

False

The operating System kernel includes all the system programs and application programs. 1) True 2) False

False

When a user thread library creates a user thread, it is guaranteed by all operating systems that a corresponding kernel thread will be created. 1) True 2) False

False

1. Which of the following will trigger an interrupt? A. kernel function B. software execution C. CPU execution IO completion

IO completion

What are the advantages of Multiprocessing or Parallel System?

Increased Throughput - by increasing the number of processors, more work can be completed in a unit time. Cost Saving - Parallel system shares the memory, buses, peripherals. Multiprocessor system thus saves money as compared to multiple single systems. Increased Reliability - In this system, as the workload is distributed among several processors which results in increased reliability. If one processor fails then its failure may slightly slow down the speed of the system but system will work smoothly.

Linux OS 1) Is a microkernel-based operating system 2) Is a monolithic operating system 3) Has a monolithic kernel and a microkernel media service layer 4) Has a microkernel core and a monolithic media service layer

Is a monolithic operating system

I/O-bound process

Is one that spends more of its time doing I/O than it spends doing computations.

Which of the following is NOT true about multi-programming: 1) It allows running multiple programs concurrently in a system 2) It allows multiple process in the memory at the same time 3) It is only possible when there are multiple processors in a system 4) It increases CPU utilization

It is only possible when there are multiple processors in a system

What does it mean to counter incrementing or decrement operations are done atomically?

It means to increment or decrement one at a time.

The part of the operating system that is running at all times is called the 1) Resource manager 2) Control program 3) Kernel 4) Security manager

Kernel

So what is synchronization, really?

Mechanisms to ensure the orderly execution of cooperating process (threads) that share a logical address space, so that data consistency is maintained.

1. A context switch involves the switch of A. device controllers. B. modes. C. I/O buffers. D. None of the rest.

None of the rest

nonpreemptive scheduling

Once the CPU has been allocated to a process the process keeps the CPU until it releases the CPU either by terminating or by switching to the wait state

1. Which of the following is true about system calls: A. A system call always has the same name no matter which operating system it is. B. All library functions defined in C language are system calls. C. One approach to pass parameter to system call is via registers. D. None of the rest.

One approach to pass parameter to system call is via registers.

The _____ model maps each user-level thread to one kernel thread. 1) Many-to-many 2) Two-level 3) One-to-one 4) Many-to-one

One-to-one

If process Po is switched to process P1, state for P0 will be saved into ____, and state from ____ will be reloaded? 1) PCB0, PCB0 2) PCB0, PCB1 3) PCB1, PCB0 4) PCB1, PCB1

PCB0, PCB1

Process Control Block

Process State, Program Counter, CPU Registers, CPU Scheduling Information, Memory Management, Accounting Information, I/O Status Information

Type of System Calls

Process control File management Device management Information maintenance Communications

Contents of a typical Operating System

Process management Main-memory management Secondary-storage management File System I/O system Protections/Security system

A running process that completes its time slice will move to the state of ______ 1) New 2) Ready 3) Waiting 4) Terminated

Ready

Benefits of threads

Responsiveness - multiple activities going "concurrently" Resource Sharing - since they share the memory and resources. Economy - easier to create and destroy Utilization of MP Architectures - each thread may be running in parallel on a different processor

Which of the following are preemptive scheduling algorithms: 1) FCFS 2) Round Robin 3) Shortest job first but do not use remaining time. 4) None of the rest 5) All of the rest

Round Robin

A privileged instruction 1) Runs in user mode 2) Runs in system mode 3) Runs in idle mode 4) Runs in low priority user mode

Runs in system mode

1. Which of the following scheduling algorithms gives the minimum average waiting time for a given set of processes? A. SJF B. FCFS C. RR D. Multilevel queue

SJF

Shortest-remaining-time-first(SRTF) scheduling is the preemptive version of ______________? 1) SJF 2) FCFS 3) RR 4) Multilevel queue

SJF

Assume process P0 and P1 are the process before and after a context switch, and PCB0 and PCB1 are respectively their process control block. Which of the following time units are included inside the dispatch latency? 1) P0 executing 2) Save state into PCB0, and restore state from PCB1 3) P1 executing 4) All of the rest

Save state into PCB0, and restore state from PCB1

Two-level model (multithreading models)

Siimilar to M:M, execpt that it also allows a user thread to be bound to kernel thread.

Does fork() duplicate only the calling thread or all threads?

Solaris threads duplicated all threads. ("lthread") POSIX threads duplicate only the calling thread.("lpthread)

Which of these is NOT a function of the operating system? 1) Storage management 2) Source code management 3) Memory management 4) Process management

Storage management

Context Switch

Switches the CPU core to another process performing a state save of the current process and a state restore of a different process.he task of saving the state of the old process and loading the save state for the new process. Pure overhead.

Which of the following is the only gateway between user space and kernel space? 1) User interface 2) System call 3) Operating system 4) Hardware drivers

System call

Which of the following is NOT a possible situation when a child process is created? 1) The child process is running concurrently with the parent process. 2) The child process and the parent process are both waiting in a device queue. 3) The child process and the parent process are both ready. 4) The child process has the same process id as the parent process.

The child process has the same process id as the parent process.

System Call

The interface between a running program and the operating system.

Deferred cancellation

The target thread has an opportunity to terminate itself in an orderly fashion

Race Condition

They occur when two computer program processes, or threads, attempt to access the same resource at the same time and cause problems in the system.

Why does a semaphores have an associated queue of processes?

To avoid starvation

1. As an example of hybrid system, macOS 's kernel environment Darwin is a layered system of Mach microkernel and the BSD Unix kernel. A. True B. False

True

1. The Completely Fair Scheduler (CFS) is the default scheduler for Linux systems. A. True B. False

True

1. The functions of an operating-system exist not only for helping the user but also for ensuring the efficient operation of the system itself. A. True B. False

True

An an example of hybrid system, macOS's kernel environment Darwin is a layered system of Mach microkernel and the BSD Unix kernel. 1) True 2) False

True

Which of the following circumstances can preemptive scheduling take place? 1) When a process switches from the running state to the waiting state 2) When a process switches from the waiting state to the ready state 3) When a process terminates 4) None of the rest

When a process switches from the waiting state to the ready state

Atomic

When there are two wait(s) and S was initially 1, S is never negative! No interleaving of instructions!

Zombie process

a process has terminated , but whose parent has not yet called wait()

Response time

amount of time it takes from when a request was submitted until the first response is produced, not output (for time-sharing environment)

Atomic operation

an operation that completes in its entirety without interruption. Indivisible!

CPU-bound process

generates I/O requests infrequently, using more of its time doing computations.

Convoy Effect

in which the whole Operating System slows down due to few slow processes.

Starvation

indefinite blocking. A process may never be removed from the semaphore queue in which it is suspended.

Binary Semaphore

integer value can range only between 0 and 1; can be simpler to implement

Counting Semaphore

integer value can range over an unrestricted domain

Priority Inversion

is a scenario in scheduling in which a high priority task is indirectly superseded by a lower priority task effectively inverting the assigned priorities of the tasks. *Inversion occurs when there is a resource contention with a low priority task that is then preempted by a medium priority task. Contents.

Priority Inheritance

is that when a job blocks one or more high-priority jobs, it ignores its original priority assignment and executes its critical section at an elevated priority level.

1. An operating system_____________________. A. is a hardware that comes with the computer you buy B. provides services such as user-OS interface C. provides resource allocation so that each process gets the exact same total CPU time D. All of the rest

provides services such as user-OS interface

1. A privileged instruction_________. A. runs in user mode B. runs in system mode C. runs in idle mode D. runs in low priority user mode

runs in system mode

1. Which of the following items does not belong to the function of a dispatcher? A. switching context from one process to another B. selecting a process among the available ones in an I/O waiting queue C. switching to user mode D. jumping to the proper location in the user program to resume that program

selecting a process among the available one in an I/O waiting queue

Inter-process Communication (IPC)

shared memory Message passing Pipes Sockets RPC (Remote Procedure Call) JAVA RMI

1. Which of the following storage medium is the slowest regarding access speed? A. cache B. solid state drive C. register D. main memory

solid state drive

What is in the stack?

temporary data storage when invoking functions (such as function parameters, return addresses, and local variables)

Asynchronous cancellation

the target thread terminates immediately, may not free a necessary system-wide resource

Dispatch latency

time it takes for the dispatcher to stop one process and start another running.

Deadlock

two or more processes are waiting indefinitely for an even that can be caused by only one of the waiting processes.

1. The two separate modes of operating in a system are A. supervisor mode and system mode B. kernel mode and privileged mode C. physical mode and logical mode D. user mode and kernel mode

user mode and kernel mode

1. Linux Kernel_____________. A. was modified in iOS to provide power management B. was modified in Android to provide power management C. was modified in Mach to provide COCOA touch. D. was modified in Android to provide COCOA touch.

was modified in Android to provide power management


Kaugnay na mga set ng pag-aaral

CGS1060 technology concepts test

View Set

FINAL EDIT: BUS 391 midterm 1 review

View Set

Sperry and Split Brain Research ***

View Set

Relationship development and therapeutic comunication

View Set

Psychology and Work Today Schultz CHAP 12

View Set

Putting the Pieces Together of Nutrition and Weight Control

View Set

Corporate finance chapter 9 questions

View Set

Quiz: Module 06 Software and Hardware Assurance Best Practices

View Set

Motorcycle knowledge test questions

View Set