CSE 130 Computer Systems Midterm

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

If a system is time share does that mean it is multiprogramming?

Yes, but if a system is multiprogramming it does not mean it is also time sharing

What is 4.4 BSD?

A unix operating system derived by the CSRG of UC Berkely from 1977 - 1995

What is Soft Affinity?

-OS attempts to return each thread to the CPU on which it was last resident using software means. -This can be overridden with hardware affinity. -This permits threads to only run on specific cores to avoid cache misses when referencing memory.

What are the fundamental goals of all super computer systems?

-Reliability -Efficiency -Availability

How does SJF predict the future?

- Decaying weighted mean - Exponential mean

What are the primary concerns of the operating system?

-CPU Scheduling -Safe and Secure Memory Management

What did operating system first start out as?

A batch job control system

What initialization steps must a user program go through before execution?

-OS structures initialized -Memory must be allocated to the process -Execution code must be loaded into that memory -Program structures must be created and initialized -Process execution is initiated

What information does the PCB contain?

-Process state -Next/prev -Process ID -Program counter -Registers -Schedule info -Memory structure -Open file table -Accounting info

What does the OS use to keep track and manage all processes in a system?

PCB

Earliest Deadline First

Priorities are assigned dynamically according to deadlines. The earlier the deadline the higher the priority.

What are the limitations semaphores bring?

-Programmers must use them correctly -Cannot test busy without blocking -We cant simultaneously wait on any of several semaphores -Indefinite blocking -Cooperative only

What does Multi-Cores offer?

Better performance for: - Multi-threaded application - Multi-tasking & time-sharing response times - Transaction processing

What does 'Turing Complete' mean?

Can be used to solve any computation problem.

What was the first general purpose computer?

Colossus (UK, 1943)

Who was credited for being the first programmable computer?

ENIAC (US,1946)

What is Pull Migration in regard to Load Balancing?

If a core is under loaded, seek an over-loaded core and migrate threads from its queue.

What hardware innovation still in use today was required to enable Spooled Batching in early computer systems?

Interrupts

What is Shortest Job First also called?

Shortest Remaining Time First

What are processes in Linux called?

Tasks

How do you handle deadlocks?

-Ignore them: this avoid performance hits and is cheap -Prevention: Limit the ways to request resources - Avoidance: Allocate resources to stop them from happening -Detect them and recover

What is Hard Affinity?

-Implemented as a bit asks where each bit corresponds to a CPU and specifies where a thread is permitted to run. This is defaulted to all CPUs -This permits threads to only run on specific cores to avoid cache misses when referencing memory.

What are the advantages of having multiple processes execute simultaneously?

-Information sharing -Performance increase -Modularity -Convenience

What are the teaching operating systems?

-MINIX -Pintos -Xv6 OS/161

What are the necessary conditions for a Deadlock?

-Mutual Exclusion -No preemption -Hold and wait -Circular Wait

How does the OS manage processes?

- Create: fork() and exec() -Coordination: wait() -Termination: exit() -Process session groups -Communication (IPC and RPC)

What are the formalized sections for a critical section and what do they do?

- Entry Section: Negotiate entry to critical section -Critical Section: Do critical Task -Exit Section: Signal critical task complete

What are the requirements for a Critical Section?

-Mutual Exclusion: Only one thread in the critical section at a time - Progress: If a thread wishes to enter an idle critical section, only threads in the entry or exit section may help decide if it is the one allowed to enter. -Bounded Wait: There exists a finite bound on the number of ties any waiting thread must "stand-aside" whilst other threads get access to the critical section.

What are all the state transitions in a typical multi-programmed operating system?

-New to Ready -Ready to Running -Running to Ready -Running to Blocked -Blocked to Ready -Running to Terminated

What is a process/threads life cycle?

-New: The process/thread is being created -Ready: Waiting to run on the CPU -Running: Instructions are being executed -Blocked: Waiting on IO to complete -Terminated: Execution is complete

What are the critical scheduling criteria and metrics?

- Utilization: (used/available) -Throughput: (threads/time) -Turnaround Time: Time a thread arrives in the ready queue and finishes execution (t_finish - t_arrive) -Waiting Time: Amount of time a thread has been waiting in the ready queue (sum of (t_start_i - t_arrive_i)) -Response Time: Amount of time from when a request was submitted until the first response is produced (t_response - t_arrive)

What Operating Systems support SMP?

- Windows - Linux - macOS

What are the steps for when Fork executes?

-Allocating and initializing a new process structure for the child process -Duplicate the entire context of the parent -Schedule the child process to run.

How is the overall wait time for a thread calculated?

-Arrival = time T initially enters the scheduled queue -Start_n = time T gets the CPU for the nth time -Finish_n = time T yields or is forced to yield the CPU for the nth time

What are the issues with Software solutions for concurrency?

-Complicated -Not Atomic -No generalized to n-threads

What does managing a process consist of?

-Creating and deleting processes -Suspending and resuming execution of processes -Allocation of runtime resources -Synchronization and communication

What are example of a producer?

-Devices -Networks -Processes

What are the Computer System goals?

-Efficiency -Convenience -Availability -Reliability

What are the requirements for deadlock prevention?

-Eliminate Mutual Exclusion -Eliminate no preemption -Eliminate hold and wait -Eliminate circular wait Note: deadlock prevention is difficult to achieve without leading to low resource utilization which leads to low throughput

What is the difference between fork() and exec()?

-Fork() creates an exact copy of the parent except the PID and runs the same program from the same program counter -Exec() is a different program altogether

What are the benefits of using multi-threads instead of multi-processes?

-Responsiveness: If one thread is blocked another can still execute without slow and costly context switching. -Sharing: Coordination easier as they share the same memory, files, etc. so no expensive IPC -Efficiency: Creating and switching threads is cheaper in time and resources than creating and switching between multiple processes. -Utilization: On machines with multiple processors and shared memory, we can schedule a thread on each processor from the same process. -Modularity: Writing smaller code units to do specific tasks is always a better design.

What are the opportunities an operating system has to make decisions on scheduling?

-Running Threads yielding -Threads terminate -An interrupt occurs -Preemption

What is the difference between a Scheduler and Dispatcher?

-Scheduler maintains the ready queue and selects next process to run from those in the ready queue. -Dispatcher puts the selected process onto the CPU by: context switching and switching to user mode.

What are the three Concurrency Primitives?

-Semaphores -Locks/Mutexes -Condition Variables

What hardware feature can be used in place of concurrency primitives?

-Test and set -Swap

What is a user-level thread?

-Thread class managed by a library external to operating systems. -Creation does not necessarily require a system call. -Kernel is unaware of their existence

What is a Kernel-level Thread?

-Thread class managed by the operating system -Creation requires a system call unless created by the kernel itself

What is a user thread?

-Thread instance created by a user process -Can be a kernel-level thread or a user-level thread.

What is a Kernel Thread?

-Thread instance created by the operating system kernel -Implicitly a kernel-level thread

What are examples of Consumers?

-User processes/threads

What is the protocol for a Resource allocation Graph?

1. Request a resource 2. Acquire an instance of a resource 3. Use the resource 4. Release the resource

What is a binary semaphore?

A concurrency primitive that allows exclusive entry into the critical section

What is a counting semaphore?

A concurrency primitive that will allow N threads into a critical section, all additional thread will then wait for threads to finish critical section.

What is a race condition?

A flaw in a system or process whereby the output of the process is unexpectedly and critically dependent on the sequence or timing of other events.

What is a thread pool?

A pool of thread to serve requests and recycles resources when certain requests are fulfilled .

What is Shortest Job First?

A scheduling algorithm that selects the process or thread with the shortest CPU burst to run first.

What is Round Robin?

A scheduling algorithm that using a quantum for every process. Once that process exceeds its quantum, it is kicked off the CPU and then next process is scheduled.

What is a deadlock?

A set of threads or processes is in a deadlock state when every thread or process in the set is waiting for an event that can only be caused by another thread or process in the set

What is Peterson's Two Thread Solution?

A software solution that satisfies all 3 requirements for a critical section, but can only be used for 2 threads and not generalized for N number of threads.

What are Monitors?

A synchronization construct that allows threads to have both exclusion and the ability to wait for a certain condition to become true.

What can be done to Multi-level Queues to resolve the possibility of starvation?

Add time slicing where each queue gets a certain minimum proportion of CPU time amongst its threads. Or introduce runtime feedback

What are the priorities for 4.4 BSD?

Kernel mode Priorities ranging from [0-49] User mode Priorities ranging [50-127]

What are deadlock prevention methods?

Possibilities: - Limit the number of threads to where they can all access the number of resources required - Each process picks up all their required resources once at a time Best Solution: -Alternate the order of threads requesting resources so multiple threads don't try to take the same resource from another.

Do process addresses need to start from zero? Explain

No, the virtual address space allocated to process can be variable and is independent of other processes

Do processes code and data need to be stored sequentially in memory?

No, they can be non-sequentially linked to a process

What is the most important role of the Operating System?

Arbitrating access to the CPU.

What are the different types of Multi-Processor Scheduling?

Asymmetric: One CPU acts as a master and schedules all CPUs in the system Symmetric: Each core is self-scheduling: if the ready queue is shared, but care must be taken with synchronization

What are the Posix Shared memory system calls?

Shm_open (): Create and open a new shared memory object or open an existing object Ftruncate (): Set the seize of the shared memory object (a newly created shared memory object has a length of zero) Mmap (): Map the shared memory object into the virtual address space of the calling process Munmap (): Unmap the shared memory object from the virtual address space of the calling process Shm_unlink (): Remove a shared memory object by name Close (): Close the file descriptor allocated by shm_open when it is no longer needed

What are key metric to look at for: -Batch systems -Multiprogramming -Time Sharing

Batch Systems: Turnaround Time because it aims to finish job batches as quick as possible Multiprogramming: Waiting Time because it aims for max CPU utilization Time Sharing/Interactive: Responsive Time because it aims to respond to users as quickly as possible

When a deadlock is detected what can be done?

Break the circular wait - Kill all deadlocked processes/threads - Kill deadlocked processes/threads one-by-one Preempt resources: -Rollback to a checkpoint Run the processes in a different sequence

If processes in a time-sharing system typically spend half their time waiting on an I/O operating to complete, what degree of multi-programming would be necessary to achieve 99% CPU utilization?

CPU utilization = 1 - p^n 0.99 = 1 - (0.5)^n -0.01 = -(0.5)^n log_0.5(0.01) = n n = 6.64 Therefore, you would at least a degree of 6, since we round down.

What are the Pros and Cons of using FCFS, RR, and SJF?

FCFS: -Pros: Simple -Cons: Short jobs can get stuck behind long ones Round Robin: -Pros: Better for short jobs -Cons: Not great for when jobs are the same length Shortest Job First: -Pros: Optimal for mean waiting time -Cons: Hard to predict the future - unfair on long jobs

What was the first commercially available general purpose computer?

Ferranti Mark 1 (UK,1951)

What are the Unix Time Sharing system calls for shared memory?

Ftok (): Generate a unique key Shmget (): Get an identifier for a shared memory segment Shmat (): Attach to the shared memory segment Shmdt (): Detach from the shared memory segment Shmctl (): Control (delete) the shared memory segment.

What are the different types of Real-Time Scheduling?

Hard Real-Time - System guarantee to complete a critical task within a specified time period Soft Real-Time - Critical processes receive priority over less important ones, but no guarantee are given New Real-Time - Not OS related

What does the Basic Computer System Architecture consist of?

Hardware: -CPU -Memory -IO Devices Operating System: -Coordinates use of hardware resources amongst applications and users Libraries and Utilities: -Provide standard functionality

Multi-level Queue

Having multiple ready queues that can utilize different scheduling algorithms.

What was the first 'stored program' computer?

Manchester Baby (UK,1949)

Where is the PCB stored?

Many OSs place it at the beginning of the kernel stack of each process, so it is only accessible during system calls.

What are the thread models?

Many-to-None: -Single process "Stand Alone" user-level threads -Kernel is unaware of their existence Many-to-One: -Equivalent to stand-alone user-level threads, and has the same advantages and shortcomings One-to-One: -Expensive, as one kernel thread is needed for each user thread Many-to-Many: -Maps N user threads to M kernel threads N>M -Best mode, neither too slow, nor blocking -This is difficult to program

What are Concurrency Primitives?

Mechanisms provided by the OS to allow threads to safely work concurrently.

What can be used to examine deadlocks?

Resource Allocation Graph

How did human operators in the earlier computer days reduce the load of being the operating system for a computer?

Sorted jobs into batches with similar runtime requirements.

What is the apparent simultaneous execution of threads?

The use of concurrency primitives and preemptions to allow multiple threads to utilize 1 CPU .

What is actual simultaneous execution of threads?

The use of multi-core and/or multi-processor to concurrently execute processes or threads.

Issues that can arise from using Multi-level Queue

There is a possibility of starvation since higher priorities queues take precedence.

What is Dispatcher Latency?

Time it takes for the dispatcher to stop one process and start another

What was the second commercially available general purpose machine?

UNIAC(US,1952)

What is Process Aging?

Used for Queue promotion when for threads that get older than some threshold.

What is a Simple Demotion Scheme?

Used in Multi-level Feedback queue to demote threads to a lower priority queue if a quantum is exceeded while running on the CPU

What is a Multi-level Feedback Queue?

Uses a scheduler to move threads between queues based on promotion and demotion scheme.

What are the functions of a Condition Variable?

Wait: Releases the lock, puts thread to sleep, and lock re-acquired before exit Signal: Wake one thread waiting for the condition. Broadcast: Same as signal, but all threads waiting for the condition are woken up.

What is Push Migration in regard to Load Balancing?

When a core is overloaded, find a comparatively unloaded core and migrate threads into its queue.

What is Rate Monotonic?

Where a given order of process execution is preserved and priority is assigned based on period. The shorter the period the higher the priority

Deadlock Avoidance: In the example below for any sequence of processes does a deadlock occur? max alloc risk P_0 10 5 5 P_1 4 2 2 P_2 9 3 6 free 2

Yes, a deadlock occurs in all combinations.

What is the issue with scheduling a thread to a different core that the one it previously ran on?

Will result in L1 & L2 cache misses which results in an increase inL3 cache hits. This is a significant performance hit


Kaugnay na mga set ng pag-aaral

Econ 202: Chapter 6 Part 1 Handout

View Set

Pharmacology II Chpt. 38 Agents to Control Blood Glucose 5-8

View Set

Islamic Art and Architecture: Terms and Images

View Set