/
Class Notes 3SH3
Save to my account
Sign up
Class Notes 3SH3
Chapter 1 - Introduction
Study
1
Question
What is an Operating System?
Answer
Program that manages a computer's hardware, provides a basis for application programs, and acts as an intermediary between a user of a computer and the computer hardware.
2
Question
What are the goals of an Operating System?
Answer
1. Efficient use 2. User convenience 3. Non interference
3
Question
What is the structure of a computer system?
Answer
1. Hardware 2. Operating System 3. Application Programs 4. Users
4
Question
What is the role of an Operating System as a resource allocator?
Answer
Manages all resources such as memory, CPU time, and I/O devices. It decides between conflicting requests for efficient and fair resource use.
5
Question
What is the role of an Operating System as a control program?
Answer
Controls the execution of programs to prevent errors and improper use of the computer.
6
Question
What is the primary component of an Operating System?
Answer
Kernel, which stays in main memory and is the one program that is always running on the computer. The Kernel controls the execution of all other programs.
7
Question
How do programs interact with the Kernel in an Operating System?
Answer
Other programs (system or user) interact with the Kernel through system calls, which are routines mostly written in a high-level language (C or C++). However, lower-level tasks are written in assembly.
8
Question
What is the role of CPUs and device controllers in a computer system organization?
Answer
One or more CPUs and device controllers connect through a common bus, providing access to shared memory.
9
Question
What does concurrent execution in a computer system refer to?
Answer
The concurrent execution of CPUs and devices competing for memory.
10
Question
What is an interrupt in the context of an operating system?
Answer
An interrupt is a mechanism that enables a device/software to notify the CPU that it needs attention.
11
Question
Why is an operating system described as event driven?
Answer
An operating system is described as event driven because events occur by interrupts, making the OS interrupt driven.
12
Question
What can cause an interrupt?
Answer
An interrupt can be caused by a signal to the CPU from a device attached to a computer via system bus hardware or from an executing program within the computer through system calls.
13
Question
What is a trap or exception?
Answer
A trap or exception is a software-generated interrupt caused either by an error or a user request.
14
Question
What happens when an interrupt occurs?
Answer
When an interrupt occurs, the CPU stops executing the current task.
15
Question
How does the operating system preserve the state of the CPU during an interrupt?
Answer
The operating system preserves the state of the CPU by storing registers and the program counter.
16
Question
What is the purpose of the Interrupt Service Routine (ISR)?
Answer
The ISR handles the interrupt after which the interrupted process resumes its execution.
17
Question
What determines what action should be taken for each type of interrupt?
Answer
Separate segments of code determine what action should be taken for each type of interrupt.
18
Question
What is the implementation challenge of the ISR?
Answer
Implementing ISR as a routine is slow and therefore inefficient.
19
Question
How are interrupts managed efficiently in an operating system?
Answer
Only predefined interrupts exist, and a table of pointers to the various interrupt routines is used instead.
20
Question
What is an interrupt vector?
Answer
An interrupt vector is a table/array of addresses that is called to manage the various interrupt routines.
21
Question
Where is the interrupt vector usually stored?
Answer
The interrupt vector is usually stored in low memory.
22
Question
How do Windows and Linux handle interrupts?
Answer
Windows and Linux dispatch interrupts using the interrupt vector approach.
23
Question
What type of memory can the CPU access?
Answer
The CPU can access only main memory, which is RAM (Random Access Memory).
24
Question
What is the characteristic of main memory?
Answer
Main memory is volatile, meaning it loses data with the loss of power.
25
Question
What is needed for permanent and large quantity data storage?
Answer
Secondary storage such as hard disk drives, CDs, magnetic tapes, etc., is needed to store data permanently and in large quantities.
26
Question
What do all forms of memory provide?
Answer
All forms of memory provide an array of bytes, and each byte has its own address.
27
Question
What is the memory layout for a multiprogrammed system?
Answer
Low Memory and High Memory.
28
Question
What is timesharing multitasking?
Answer
Timesharing multitasking is a logical extension of multiprogramming where the CPU switches jobs so frequently that users can interact with each job while it is running, creating interactive computing.
29
Question
What is the desired response time for interactive computing?
Answer
The response time should be 1 second.
30
Question
What does each user have in memory during timesharing multitasking?
Answer
Each user has at least one program executing in memory, called a process.
Untitled Flashcards
Study
1
Question
What services does an operating system provide to the user?
Answer
User interface to interact with OS (e.g., CLI, GUI, touch screen interface), Program execution, IO operations, File system manipulation, Communications, Error detection.
2
Question
What are the resource management services provided by an operating system?
Answer
Resource allocation, Accounting, Protection and Security.
3
Question
What is the function of the Command Line Interpreter (CLI) in an operating system?
Answer
The primary job of the CLI is to fetch a command from the user and execute it.
4
Question
Is the Command Line Interpreter (CLI) part of the kernel in Windows and Unix?
Answer
No, the CLI is not part of the kernel in Windows and Unix.
5
Question
What are shells in Unix/Linux?
Answer
In Unix/Linux, shells are programs like bash that allow users to interact with the operating system through the command line.
6
Question
What happens when you enter a command like 'rm filetext' in the terminal?
Answer
The shell invokes the command 'rm', searches for the file, loads 'rm' in memory, and executes it with 'filetext' as a parameter.
7
Question
What is the role of the shell regarding the implementation of commands?
Answer
The shell has no idea how the command (e.g., 'rm') is implemented or the system calls used to process the request.
8
Question
What are the different structures of an operating system?
Answer
Monolithic, Layered, Microkernel, Modular.
9
Question
What does a general-purpose operating system refer to?
Answer
A general-purpose OS is a very large program that can handle various tasks for users and applications.
10
Question
What is a simple monolithic structure in operating systems?
Answer
A simple monolithic structure has little to no structure at all, where all the functionality of the kernel, process memory, and file I/O is placed into a single static binary file that runs in a single address space.
11
Question
Give an example of a simple monolithic structure.
Answer
MS-DOS is an example of a simple monolithic structure.
12
Question
What characterizes a non-simple monolithic structure?
Answer
A non-simple monolithic structure has some structuring and the kernel handles several OS tasks, including CPU memory management and file systems.
13
Question
What is an example of a non-simple monolithic structure?
Answer
The original UNIX OS is an example of a non-simple monolithic structure.
14
Question
What are the advantages of a simple monolithic structure?
Answer
The advantages include simplicity and speed.
15
Question
What are the disadvantages of a simple monolithic structure?
Answer
The disadvantages include being harder to implement and extend.
16
Question
How is a simplified non-simple monolithic structure organized?
Answer
A simplified non-simple monolithic structure is divided into a number of layers or levels, where each layer is built on top of lower layers.
17
Question
What is the bottom layer (layer 0) in a layered approach?
Answer
The bottom layer (layer 0) is the hardware.
18
Question
What is the highest layer (layer N) in a layered approach?
Answer
The highest layer (layer N) is the user interface.
19
Question
What is a disadvantage of the layered approach?
Answer
A disadvantage is that it can be tricky to delineate the layers and any user request needs to go through all the layers with the correct function calls and parameters.
20
Question
What does a layered approach do to the operating system?
Answer
The layered approach structures the operating system by removing all nonessential components from the kernel and implementing them as user or system level programs.
21
Question
What is the role of microkernels?
Answer
Microkernels provide minimal process and memory management, with communication between the modules taking place using message passing.
22
Question
What is an example of a microkernel?
Answer
Mach is an example of a microkernel.
23
Question
What is the open source kernel partly based on Mach?
Answer
Mac OS X open source kernel Darwin is partly based on Mach.
24
Question
What initial approach did Windows NT use for its kernel structure?
Answer
Windows NT's first release had a layered microkernel approach.
25
Question
What are the advantages of a microkernel system structure?
Answer
Advantages include being easier to extend, easier to port to new architectures, and being more reliable and secure.
26
Question
What is a disadvantage of using a microkernel?
Answer
A disadvantage is the performance overhead of user space to kernel space communication.
27
Question
What are the core components of a kernel?
Answer
Kernel has a set of separate core components with clearly defined interfaces.
28
Question
How are additional services linked into the kernel?
Answer
Additional services are linked in via modules either at boot time or run time.
29
Question
What is unique about the loadable kernel modules?
Answer
Each module is loadable as needed within the kernel.
30
Question
Which modern operating systems implement loadable kernel modules?
Answer
Many modern operating systems such as UNIX, Linux, Solaris, and Windows implement loadable kernel modules.
Chapter 3
Study
1
Question
What is a process?
Answer
A process is a program in execution.
2
Question
What is a program?
Answer
A program is a passive entity stored on disk as an executable file.
3
Question
How does a program become a process?
Answer
A program becomes a process when its executable file is loaded into memory.
4
Question
Can you have one program and many processes?
Answer
Yes, one program can have many processes.
5
Question
What is temporary data storage in a process used for?
Answer
Temporary data storage in a process is used for invoking functions, function parameters, local variables, etc.
6
Question
What is dynamically allocated memory in a process?
Answer
Dynamically allocated memory is used for temporary data storage during the execution of a process.
7
Question
What are global variables in the context of a process?
Answer
Global variables are variables that are accessible throughout the entire process.
8
Question
What is a Process Control Block (PCB)?
Answer
A Process Control Block (PCB) stores all the information associated with each process, also called a task control block.
9
Question
What information is stored in a PCB?
Answer
Information stored in a PCB includes process state, process number (Process ID), CPU registers, program counter, CPU scheduling information, and memory management information.
10
Question
What does 'process state' refer to in a PCB?
Answer
Process state refers to the current status of the process, which can be running, waiting, etc.
11
Question
What is a Process ID?
Answer
A Process ID is a unique identifier assigned to each process.
12
Question
What does the PCB contain regarding CPU registers?
Answer
The PCB contains the contents of all process-centric registers, including CPU registers and program counter.
13
Question
What is CPU scheduling information in a PCB?
Answer
CPU scheduling information includes priorities and scheduling queue pointers.
14
Question
What memory management information is included in a PCB?
Answer
Memory management information includes the memory allocated to the process.
15
Question
How is a process represented in Linux?
Answer
In Linux, a process is represented by the C structure 'taskstruct'.
16
Question
What is the 'pid' in 'taskstruct'?
Answer
The 'pid' in 'taskstruct' refers to the process identifier.
17
Question
What does 'state' indicate in a 'taskstruct'?
Answer
The 'state' indicates the state of the process.
18
Question
What does 'timeslice' refer to in scheduling information of 'taskstruct'?
Answer
'timeslice' refers to the amount of time a process is allowed to run before being preempted.
19
Question
What does 'parent' signify in 'taskstruct'?
Answer
'parent' indicates this process's parent process.
20
Question
What does 'children' signify in 'taskstruct'?
Answer
'children' indicates this process's child processes.
21
Question
What does 'struct files' represent in 'taskstruct'?
Answer
'struct files' represents the list of open files for the process.
22
Question
What are the different states of a process during its execution?
Answer
1. New: The process is being created. 2. Ready: The process is waiting to be assigned to a processor. 3. Running: Instructions are being executed. 4. Waiting: The process is waiting for some event to occur. 5. Terminated: The process has finished execution.
23
Question
What is the difference between an IO bound process and a CPU bound process?
Answer
IO bound process spends more time doing IO than computations and has many short CPU bursts. CPU bound process spends more time doing computations and has few very long CPU bursts.
24
Question
What is a thread in the context of modern operating systems?
Answer
A thread is an entity within a process that can execute concurrently with other threads within the same process.
25
Question
What is context switching in operating systems?
Answer
Context switching is the process of saving the context of the old process and loading the saved context for the new process when the CPU switches to another process.
26
Question
What is the significance of context switch time?
Answer
Context switch time is an overhead for the system, as the system does no useful work while switching.
27
Question
What factors influence context switch time?
Answer
Context switch time is dependent on hardware support; some hardware provides multiple sets of registers per CPU, allowing multiple contexts to be loaded at once.
28
Question
What is represented in the PCB (Process Control Block)?
Answer
The context of a process is represented in the PCB.
29
Question
What are the operations on processes that the system must provide mechanisms for?
Answer
Process creation and process termination.
30
Question
What is the identifier given to every process called?
Answer
Process identifier (PID).
Chapter 4
Study
1
Question
What is a traditional process in terms of threading?
Answer
A traditional process has a single thread of control.
2
Question
What distinguishes multi-threaded applications from traditional processes?
Answer
Multi-threaded applications have multiple threads within a single process.
3
Question
What is the basic unit of CPU utilization when the operating system supports threads?
Answer
A thread is a basic unit of CPU utilization.
4
Question
How does the weight of process creation compare to thread creation?
Answer
Process creation is many times heavy weight, while thread creation is light weight.
5
Question
What are the components of each thread?
Answer
Each thread consists of: 1. Thread ID 2. Program Counter 3. Set of registers 4. Stack.
6
Question
What do threads share within a process?
Answer
Threads share other components of the process such as code, data, and files.
7
Question
Provide an example of multi-threading in word processing applications.
Answer
In editing a word document, different threads interpret keystrokes, display images, check spelling and grammar, and perform automatic backups periodically.
8
Question
Why are many operating system kernels multi-threaded?
Answer
Many operating system kernels are multi-threaded to allow each thread to perform a specific task within the kernel process.
9
Question
List the advantages of using threads.
Answer
1. Responsiveness: may allow continued execution if part of the process is blocked, which is especially important for user interfaces. 2. Resource Sharing: threads share resources by default, making it easier than processes. 3. Economy: thread switching has lower overhead than context switching, making it cheaper than process creation. 4. Scalability: a single process can take advantage of multiprocessor architectures, enabling concurrent programming and true parallelism.
10
Question
What does parallelism imply in computing?
Answer
Parallelism implies a system can perform more than one task simultaneously.
11
Question
What does parallelism involve on a multi-core system?
Answer
Parallelism on a multi-core system involves the ability to execute multiple tasks across different cores.
12
Question
What is concurrency in computing?
Answer
Concurrency supports more than one task making progress.
13
Question
How does a single processor/core scheduler provide concurrency?
Answer
A single processor/core scheduler provides concurrency by managing the execution of multiple tasks, allowing them to make progress in overlapping time periods.
14
Question
Is it possible to have concurrency without parallelism?
Answer
Yes, it is possible to have concurrency without parallelism.
15
Question
What are some challenges faced in multicore programming?
Answer
1. Dividing activities and identifying tasks that can be performed concurrently. 2. Balancing thread creation overhead with performance gain. 3. Data splitting to prevent interference. 4. Managing data dependency. 5. Enabling synchronization. 6. Testing and debugging, which can be challenging due to race conditions.
16
Question
What are the two types of parallelism in multicore programming?
Answer
The two types of parallelism in multicore programming are Data parallelism and Task parallelism.
17
Question
What is data parallelism?
Answer
Data parallelism distributes subsets of the same data across multiple cores, performing the same operation on each subset.
18
Question
Can you provide an example of data parallelism?
Answer
An example of data parallelism is adding numbers from 1 to N, where N is large. The set is divided into a number of cores, and the same computation is performed on each set.
19
Question
What is task parallelism?
Answer
Task parallelism involves distributing threads across cores, with each thread performing a unique operation.
20
Question
Can you give an example of task parallelism?
Answer
An example of task parallelism is the Windows word document example, where different threads perform unique operations on the document.
21
Question
What is the relationship between multicore systems and programmer challenges?
Answer
Multicore or multiprocessor systems put pressure on programmers due to the increased complexity of managing concurrency, data dependencies, and optimizing performance.
22
Question
What does Amdahl's Law identify?
Answer
Performance gains from adding additional cores to an application that has both serial and parallel components.
23
Question
What is the formula for Amdahl's Law in terms of serial portion S and processing cores N?
Answer
The formula for Amdahl's Law is the following figure, where: S is the part of the program that is serial (cannot be parallelized). N is the number of processing cores (or processors).
24
Question
In the context of Amdahl's Law, if an application is 75% parallel, what is the serial portion?
Answer
If an application is 75% parallel, the serial portion S is 25%, or S=0.25 in the formula.
25
Question
What is the result of moving from 1 to 2 cores according to Amdahl's Law?
Answer
Moving from 1 to 2 cores results in a speedup of 16 times.
26
Question
What happens to speedup as N approaches infinity according to Amdahl's Law?
Answer
As N approaches infinity, the speedup approaches 1.
27
Question
What does Amdahl's Law suggest about adding more processes after a certain number?
Answer
Amdahl's Law suggests that adding more processes after a certain number has no effect on speedup.
28
Question
What is a criticism of Amdahl's Law?
Answer
Some suggest that the formula does not account for hardware performance, therefore ceases to apply when N is high.
29
Question
What relationship must exist between kernel and user level threads?
Answer
A relationship must exist between kernel and user level threads, as kernel level threads support the functioning of the kernel.
30
Question
What must the operating system provide for user-created threads?
Answer
The OS must provide support to schedule and execute user-created threads on the CPU.
Chapter 5 - CPU Scheduling
Study
1
Question
What is the primary resource that the Operating System schedules?
Answer
The CPU is the primary resource that the Operating System schedules.
2
Question
What is central to Operating System design regarding CPU utilization?
Answer
Scheduling processes to execute on the CPU is central to Operating System design.
3
Question
Why is maximizing CPU utilization feasible?
Answer
Maximizing CPU utilization is feasible as processes alternate using the CPU and waiting for I/O.
4
Question
What are the two types of bursts in process execution?
Answer
The two types of bursts in process execution are CPU burst and I/O burst.
5
Question
What characterizes an I/O bound program?
Answer
An I/O bound program typically has many short CPU bursts.
6
Question
What characterizes a CPU bound program?
Answer
A CPU bound program might have a few long CPU bursts.
7
Question
Why is the distribution of I/O bound and CPU bound programs important?
Answer
The distribution of I/O bound and CPU bound programs is important in the selection of an appropriate CPU scheduling algorithm.
8
Question
What does the Operating System maintain for process scheduling?
Answer
The Operating System maintains scheduling queues of processes.
9
Question
What is a job queue?
Answer
A job queue is a set of all processes in the system.
10
Question
What is a ready queue?
Answer
A ready queue is a set of all processes residing in main memory that are ready and waiting to execute.
11
Question
What are device queues?
Answer
Device queues are sets of processes waiting for an I/O device, usually with a separate device queue for each device.
12
Question
What does the process scheduler do?
Answer
The process scheduler selects a process from a queue by implementing an appropriate scheduling algorithm.
13
Question
What does the queueing diagram represent in process scheduling?
Answer
The queueing diagram represents queues, resources, and flows in the representation of process scheduling.
14
Question
What is a CPU scheduler?
Answer
The CPU scheduler, also known as the short term scheduler, selects from among the processes in the ready queue and allocates the CPU to one of them.
15
Question
When is the short term scheduler invoked?
Answer
The short term scheduler is invoked frequently, typically every few milliseconds, and must be fast.
16
Question
What are the two types of scheduling?
Answer
Non-preemptive scheduling and Preemptive scheduling.
17
Question
What is non-preemptive scheduling?
Answer
In non-preemptive scheduling, a running process is executed till completion without interruption.
18
Question
What is preemptive scheduling?
Answer
In preemptive scheduling, a running process may be interrupted and moved to the ready queue by the operating system.
19
Question
What is the role of the dispatcher?
Answer
The dispatcher module gives control of the CPU to the process selected by the short term scheduler, which involves context switching to user mode and jumping to the proper location in the user program to restart that program.
20
Question
What is dispatch latency?
Answer
Dispatch latency is the time taken by the dispatcher to stop one process and start another process onto the CPU.
21
Question
What is the scheduling criterion: CPU utilization?
Answer
CPU utilization aims to keep the CPU as busy as possible.
22
Question
What is throughput in the context of CPU scheduling?
Answer
Throughput refers to the number of processes that complete their execution per time unit.
23
Question
What is waiting time?
Answer
Waiting time is the amount of time a process has been waiting in the ready queue.
24
Question
How is average waiting time calculated?
Answer
Average waiting time is calculated as the total waiting time of all processes divided by the total number of processes.
25
Question
What is turnaround time?
Answer
Turnaround time is the amount of time to execute a particular process.
26
Question
What components make up turnaround time for a process?
Answer
Turnaround time for a process is the sum of waiting time and CPU burst time.
27
Question
What are the scheduling criteria for operating systems?
Answer
Maximize CPU utilization and throughput; Minimize turnaround time and waiting time.
28
Question
What is a Gantt Chart?
Answer
Bar chart that illustrates a particular process schedule including the start and finish times of each of the participating processes.
29
Question
What is the First Come First Serve (FCFS) Scheduling?
Answer
FCFS Scheduling is a scheduling algorithm where the process requesting the CPU first is allocated the CPU first. It is implemented with a FIFO queue and is non-preemptive.
30
Question
What is the disadvantage of FCFS scheduling?
Answer
The disadvantage of FCFS scheduling is that the average CPU waiting time for a process to use the CPU is long.