Duplicate
Export
Register
Class Notes 3SH3
5 Flashcard Decks
Chapter 1 - Introduction
Study
What is an Operating System?
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.
What are the goals of an Operating System?
1. Efficient use 2. User convenience 3. Non interference
What is the structure of a computer system?
1. Hardware 2. Operating System 3. Application Programs 4. Users
What is the role of an Operating System as a resource allocator?
Manages all resources such as memory, CPU time, and I/O devices. It decides between conflicting requests for efficient and fair resource use.
What is the role of an Operating System as a control program?
Controls the execution of programs to prevent errors and improper use of the computer.
What is the primary component of an Operating System?
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.
How do programs interact with the Kernel in an Operating System?
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.
What is the role of CPUs and device controllers in a computer system organization?
One or more CPUs and device controllers connect through a common bus, providing access to shared memory.
What does concurrent execution in a computer system refer to?
The concurrent execution of CPUs and devices competing for memory.
What is an interrupt in the context of an operating system?
An interrupt is a mechanism that enables a device/software to notify the CPU that it needs attention.
Why is an operating system described as event driven?
An operating system is described as event driven because events occur by interrupts, making the OS interrupt driven.
What can cause an interrupt?
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.
What is a trap or exception?
A trap or exception is a software-generated interrupt caused either by an error or a user request.
What happens when an interrupt occurs?
When an interrupt occurs, the CPU stops executing the current task.
How does the operating system preserve the state of the CPU during an interrupt?
The operating system preserves the state of the CPU by storing registers and the program counter.
What is the purpose of the Interrupt Service Routine (ISR)?
The ISR handles the interrupt after which the interrupted process resumes its execution.
What determines what action should be taken for each type of interrupt?
Separate segments of code determine what action should be taken for each type of interrupt.
What is the implementation challenge of the ISR?
Implementing ISR as a routine is slow and therefore inefficient.
How are interrupts managed efficiently in an operating system?
Only predefined interrupts exist, and a table of pointers to the various interrupt routines is used instead.
What is an interrupt vector?
An interrupt vector is a table/array of addresses that is called to manage the various interrupt routines.
Where is the interrupt vector usually stored?
The interrupt vector is usually stored in low memory.
How do Windows and Linux handle interrupts?
Windows and Linux dispatch interrupts using the interrupt vector approach.
What type of memory can the CPU access?
The CPU can access only main memory, which is RAM (Random Access Memory).
What is the characteristic of main memory?
Main memory is volatile, meaning it loses data with the loss of power.
What is needed for permanent and large quantity data storage?
Secondary storage such as hard disk drives, CDs, magnetic tapes, etc., is needed to store data permanently and in large quantities.
What do all forms of memory provide?
All forms of memory provide an array of bytes, and each byte has its own address.
What is the memory layout for a multiprogrammed system?
Low Memory and High Memory.
What is timesharing multitasking?
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.
What is the desired response time for interactive computing?
The response time should be 1 second.
What does each user have in memory during timesharing multitasking?
Each user has at least one program executing in memory, called a process.
What occurs if several jobs are ready to run at the same time?
CPU scheduling is applied.
What is dual mode operation in operating systems?
Dual mode operation allows the operating system to protect itself and other system components.
What are the two modes in dual mode operation?
User mode and kernel mode.
What is the purpose of the mode bit in the CPU?
The mode bit is a CPU status bit used to indicate the current mode, providing the ability to distinguish when the CPU is running in user code or kernel code.
What indicates kernel mode and user mode in the mode bit?
Kernel mode is indicated by bit 0 and user mode by bit 1.
Where can privileged instructions be executed?
Privileged instructions can only be executed in kernel mode.
What happens during a system call in terms of mode?
A system call changes the mode to kernel, and returning from the call resets it to user mode.
What is the function of the timer in an operating system?
The timer is a hardware component that can be set to interrupt the computer after a specified period.
How does the timer help in operating systems?
The timer helps to prevent infinite loops and processes from hogging resources.
How does the operating system set the time period for the timer?
The operating system maintains a counter and sets its value using a privileged instruction which is decremented by the physical clock.
What occurs when the timer's counter reaches zero?
An interrupt is generated when the counter reaches zero.
What is the basic unit of computer storage?
A bit, which can be either 0 or 1.
How many bits are in a byte?
A byte is made up of 8 bits.
What is the smallest convenient chunk of storage on most computers?
A byte.
Why do most computers not have an instruction to move a bit?
Most computers do have an instruction to move a byte instead.
What is a word in computer architecture?
A word is the native unit of data in a computer architecture, made up of one or more bytes.
What is the typical size of a word in a computer with 64-bit registers and memory addressing?
64 bits, or 8 bytes.
How does a computer execute operations in terms of word size?
A computer executes many operations in its native word size rather than byte by byte.
What is Cache in computer systems?
Cache is a faster storage system than main memory, located very close to the CPU or within the CPU itself (e.g., instruction cache).
What happens when CPU needs a piece of information from cache?
The CPU first checks the cache; if it finds it, it is called a Hit.
What is a Miss in the context of cache?
A Miss occurs when the information is not found in the cache.
What does the CPU do if it experiences a Miss?
The CPU gets the information from main memory and places a copy of it in the cache.
How does cache size and replacement policy affect system performance?
Careful selection of cache size and replacement policy greatly increases the system's performance.
What is the bootstrap program?
The bootstrap program is automatically loaded when a computer system is switched on or rebooted, stored in a reserved part of an IO device, typically a disk ROM or EEPROM.
What does the bootstrap program do?
It loads the kernel and system programs, also known as system daemons.
What do kernel and system programs do once the system is fully booted?
They run all the time on the computer to provide services.
What event does the system wait for after it is fully booted?
The system waits for an event to occur.
What is multiprogramming in operating systems?
Multiprogramming organizes jobs, code, and data so the CPU always has one to execute.
How does an operating system manage jobs in multiprogramming?
A subset of total jobs in the system is kept in memory, and one job is selected and run via job scheduling.
What happens to a job in multiprogramming when it has to wait for IO?
The operating system switches to another job.
What are the key functionalities of an operating system as a resource manager?
Process Management, Memory Management, Storage and File Management, Protection and Security.
What is a process in operating systems?
A process is a program in execution. A program is a passive entity stored on disk as an executable file, whereas a process is an active entity.
When does a program become a process?
A program becomes a process when the executable file is loaded into memory.
How are processes represented in Linux?
Processes in Linux are referred to as tasks and are represented by the C structure 'taskstruct'.
What is the 'pid' in the context of 'taskstruct'?
'pid' stands for process identifier.
What does the 'state' attribute in 'taskstruct' represent?
The 'state' attribute represents the state of the process.
What type is 'timeslice' in 'taskstruct'?
'timeslice' is of type 'unsigned int' and contains scheduling information.
What does the 'parent' attribute in 'taskstruct' represent?
The 'parent' attribute represents this process's parent.
What does the 'children' attribute in 'taskstruct' represent?
The 'children' attribute represents this process's children.
What is virtualization in computing environments?
Virtualization is a technology that creates an abstraction of the computer hardware, creating an illusion that all its operating systems are running on their own private computer.
What does VMM stand for and what does it do?
VMM stands for Virtual Machine Manager, and it provides virtualization services.
To which class of software does virtualization belong?
Virtualization belongs to the Emulation class of software.
What is emulation in the context of computing?
Emulation is a methodology used when compiled programs' source CPU type is different from the target CPU type.
What is a disadvantage of emulation?
The disadvantage of emulation is that it is a lot slower.
What are the components of virtualization as represented in the text?
The components include hardware, kernel, processes, and the virtual machine manager.
Send to Chat
AI Edit
Normal Text
Highlight
Untitled Flashcards
Study
What services does an operating system provide to the user?
User interface to interact with OS (e.g., CLI, GUI, touch screen interface), Program execution, IO operations, File system manipulation, Communications, Error detection.
What are the resource management services provided by an operating system?
Resource allocation, Accounting, Protection and Security.
What is the function of the Command Line Interpreter (CLI) in an operating system?
The primary job of the CLI is to fetch a command from the user and execute it.
Is the Command Line Interpreter (CLI) part of the kernel in Windows and Unix?
No, the CLI is not part of the kernel in Windows and Unix.
What are shells in Unix/Linux?
In Unix/Linux, shells are programs like bash that allow users to interact with the operating system through the command line.
What happens when you enter a command like 'rm filetext' in the terminal?
The shell invokes the command 'rm', searches for the file, loads 'rm' in memory, and executes it with 'filetext' as a parameter.
What is the role of the shell regarding the implementation of commands?
The shell has no idea how the command (e.g., 'rm') is implemented or the system calls used to process the request.
What are the different structures of an operating system?
Monolithic, Layered, Microkernel, Modular.
What does a general-purpose operating system refer to?
A general-purpose OS is a very large program that can handle various tasks for users and applications.
What is a simple monolithic structure in operating systems?
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.
Give an example of a simple monolithic structure.
MS-DOS is an example of a simple monolithic structure.
What characterizes a non-simple monolithic structure?
A non-simple monolithic structure has some structuring and the kernel handles several OS tasks, including CPU memory management and file systems.
What is an example of a non-simple monolithic structure?
The original UNIX OS is an example of a non-simple monolithic structure.
What are the advantages of a simple monolithic structure?
The advantages include simplicity and speed.
What are the disadvantages of a simple monolithic structure?
The disadvantages include being harder to implement and extend.
How is a simplified non-simple monolithic structure organized?
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.
What is the bottom layer (layer 0) in a layered approach?
The bottom layer (layer 0) is the hardware.
What is the highest layer (layer N) in a layered approach?
The highest layer (layer N) is the user interface.
What is a disadvantage of the layered approach?
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.
What does a layered approach do to the operating system?
The layered approach structures the operating system by removing all nonessential components from the kernel and implementing them as user or system level programs.
What is the role of microkernels?
Microkernels provide minimal process and memory management, with communication between the modules taking place using message passing.
What is an example of a microkernel?
Mach is an example of a microkernel.
What is the open source kernel partly based on Mach?
Mac OS X open source kernel Darwin is partly based on Mach.
What initial approach did Windows NT use for its kernel structure?
Windows NT's first release had a layered microkernel approach.
What are the advantages of a microkernel system structure?
Advantages include being easier to extend, easier to port to new architectures, and being more reliable and secure.
What is a disadvantage of using a microkernel?
A disadvantage is the performance overhead of user space to kernel space communication.
What are the core components of a kernel?
Kernel has a set of separate core components with clearly defined interfaces.
How are additional services linked into the kernel?
Additional services are linked in via modules either at boot time or run time.
What is unique about the loadable kernel modules?
Each module is loadable as needed within the kernel.
Which modern operating systems implement loadable kernel modules?
Many modern operating systems such as UNIX, Linux, Solaris, and Windows implement loadable kernel modules.
What is the best methodology for OS design according to the text?
The best methodology for OS design is the use of loadable kernel modules.
What is the modular structure in operating systems?
The modular structure allows operating systems to use modules for adding functionality.
What is the Solaris modular approach?
The Solaris modular approach is a hybrid model that combines multiple approaches to address performance, security, and usability needs.
What type of kernel do Linux and Solaris use?
Linux and Solaris kernels are monolithic for efficient performance and modular with dynamic loading of functionality.
What are system calls?
System Calls provide an interface to OS services.
How are system calls typically written?
System Calls are routines mostly written in a high level language such as C or C++, but lower level tasks are written in assembly.
What is an API?
An API (Application Programming Interface) is a set of routines, protocols, and tools for building software and applications.
What are System Calls accessed by programs through?
System Calls are accessed by programs via a high level Application Programming Interface (API) rather than direct system call use.
What does an API specify?
An API specifies a set of interfaces/functions available to the programmer.
How can API interfaces be implemented?
These interfaces can be implemented as single or multiple system calls.
What are the three most common APIs mentioned?
The three most common APIs are: 1. Win32 API for Windows 2. POSIX API for POSIX based systems (UNIX, Linux, and Mac OS X) 3. Java API for the Java virtual machine (JVM).
What is an example of a standard API system call sequence?
An example of a standard API system call sequence is to copy the contents of one file to another file.
How many system calls can be executed per second?
Thousands of system calls can be executed per second.
Do programmers see the level of detail at which system calls are executed?
No, programmers do not see this level of detail.
What are some examples of system calls in Windows and Unix?
Examples of Windows and Unix system calls were mentioned, but specific examples were not provided in the text.
What are system programs also known as?
System programs are also known as system utilities.
Are system programs necessarily part of the kernel?
No, system programs are associated with the operating system but are not necessarily part of the kernel.
What are some functions of system programs?
System programs exist for several OS tasks such as file management, programming language support, program loading and execution, and communications.
What are continuously running system program processes known as?
Continuously running system program processes are known as services, subsystems, or daemons.
Chapter 3
Study
What is a process?
A process is a program in execution.
What is a program?
A program is a passive entity stored on disk as an executable file.
How does a program become a process?
A program becomes a process when its executable file is loaded into memory.
Can you have one program and many processes?
Yes, one program can have many processes.
What is temporary data storage in a process used for?
Temporary data storage in a process is used for invoking functions, function parameters, local variables, etc.
What is dynamically allocated memory in a process?
Dynamically allocated memory is used for temporary data storage during the execution of a process.
What are global variables in the context of a process?
Global variables are variables that are accessible throughout the entire process.
What is a Process Control Block (PCB)?
A Process Control Block (PCB) stores all the information associated with each process, also called a task control block.
What information is stored in a PCB?
Information stored in a PCB includes process state, process number (Process ID), CPU registers, program counter, CPU scheduling information, and memory management information.
What does 'process state' refer to in a PCB?
Process state refers to the current status of the process, which can be running, waiting, etc.
What is a Process ID?
A Process ID is a unique identifier assigned to each process.
What does the PCB contain regarding CPU registers?
The PCB contains the contents of all process-centric registers, including CPU registers and program counter.
What is CPU scheduling information in a PCB?
CPU scheduling information includes priorities and scheduling queue pointers.
What memory management information is included in a PCB?
Memory management information includes the memory allocated to the process.
How is a process represented in Linux?
In Linux, a process is represented by the C structure 'taskstruct'.
What is the 'pid' in 'taskstruct'?
The 'pid' in 'taskstruct' refers to the process identifier.
What does 'state' indicate in a 'taskstruct'?
The 'state' indicates the state of the process.
What does 'timeslice' refer to in scheduling information of 'taskstruct'?
'timeslice' refers to the amount of time a process is allowed to run before being preempted.
What does 'parent' signify in 'taskstruct'?
'parent' indicates this process's parent process.
What does 'children' signify in 'taskstruct'?
'children' indicates this process's child processes.
What does 'struct files' represent in 'taskstruct'?
'struct files' represents the list of open files for the process.
What are the different states of a process during its execution?
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.
What is the difference between an IO bound process and a CPU bound process?
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.
What is a thread in the context of modern operating systems?
A thread is an entity within a process that can execute concurrently with other threads within the same process.
What is context switching in operating systems?
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.
What is the significance of context switch time?
Context switch time is an overhead for the system, as the system does no useful work while switching.
What factors influence context switch time?
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.
What is represented in the PCB (Process Control Block)?
The context of a process is represented in the PCB.
What are the operations on processes that the system must provide mechanisms for?
Process creation and process termination.
What is the identifier given to every process called?
Process identifier (PID).
How is a child process created?
A child process is created by a parent process using system calls.
What is the term used for the parent process identifier?
Parent PID (PPID).
What process is executed at system startup in newer Linux distributions?
init or systemd.
What process identifier is assigned to init during system startup?
Process identifier 1.
What does init do after startup?
Init launches all system daemons and user logins and becomes the parent of all other processes.
What are the resource sharing options between a parent and child process?
1. Parent and children share all resources. 2. Children share a subset of parent’s resources. 3. Parent and child share no resources.
What are the execution options for parent and child processes?
1. Parent and children execute concurrently. 2. Parent waits until children terminate.
What are the address space sharing options for child processes?
1. Child is a duplicate of parent and has the same program and data as the parent. 2. Child has a new program loaded into it.
What must the system provide mechanisms for regarding processes?
The system must provide mechanisms for process creation and process termination.
What is the integer identifier given to every process called?
The integer identifier given to every process is called the process identifier (PID).
What is the relationship between a parent process and a child process?
A parent process can create another process, known as a child process.
How do parent processes create child processes?
Parent processes create child processes using system calls, which in turn creates other processes, forming a tree of processes or process tree.
What additional identifier is stored along with the PID of a process?
Along with the PID of a process, its parent PID, termed as PPID, is also stored.
What does 'init' do after system startup?
After system startup, 'init' launches all system daemons and user logins and becomes the parent of all other processes.
What are the resource sharing options between a parent and child process?
1. Parent and children share all resources. 2. Children share a subset of the parent's resources. 3. Parent and child share no resources.
What are the execution options for a parent and child process?
1. Parent and children execute concurrently. 2. Parent waits until children terminate.
What are the address space sharing options between a parent and child process?
1. Child is a duplicate of parent and has the same program and data as the parent. 2. Child has a new program loaded into it.
What is the purpose of the fork system call in Linux/Unix?
The fork system call is used to create a new process.
Does the fork system call take any arguments?
No, the fork system call takes no arguments.
What happens to the process that calls fork?
The process that calls fork becomes the parent process of the new child process created.
What does fork return when the creation of the child process is unsuccessful?
Fork returns a negative value if the creation of the child process was unsuccessful.
What is the relationship in terms of environment between the parent process and the child process created by fork?
The child process has the same environment as its parent, meaning it is an exact copy of the parent with only a different process ID.
Do the child and parent processes share the same address space?
No, the child and parent processes have different address spaces.
What happens after a new child process is created with fork?
Both the parent and child will execute the next instruction following the fork system call.
How many processes including the parent are created with the following code: int main { fork(); fork(); fork(); return 0; }?
The number of processes created is 8 including the parent. (1 * 2 * 2 * 2 = 8)
The process tree includes P1 (parent), P2 (first child), P3 (second child), P4, P5, P6, P7, P8.
How do we distinguish between a child process and a parent process?
Fork returns a zero in the child process and returns the PID of the child process in the parent process.
How can a process get its own PID?
Every process can query its own PID using the getpid() function.
How can a process get its parent PID?
Every process can query its parent PID using the getppid() function.
What is the return value of fork in the parent process?
Fork returns the PID of the child process in the parent process.
What does the fork return in the child process?
Fork returns 0 in the child process.
In the provided code, what is the type used to store Process ID?
pid_t is the type used to store Process ID.
In the following code: 'if pid == 0 { printf("Child Process with PID %d\n", getpid()); } else { printf("Parent Process with PID %d\n", getpid()); }', what does pid == 0 signify?
pid == 0 signifies that the current process is the child process.
What is the purpose of the 'fork' function?
The 'fork' function is used to create a new process by duplicating the calling process. It returns the child's process ID (pid) to the parent process and returns 0 to the newly created child process.
What are pid1 and pid2 in the context of the process tree provided?
pid1 and pid2 represent the process IDs of the processes created by the fork calls in the code. Each process created will have its own unique pid.
What is the output at Line A and why according to Question 4?
PARENT: value = 5 The parent and child processes have separate memory spaces, so changes made to the value in the child process do not affect the value in the parent process.
What are the values of pid at lines A, B, C, and D as per Question 5?
A = 0 B = 2603 C = 2603 D = 2600 Line A (pid = 0): In the child process, fork() returns 0 to signify it's the child. Line B (pid1 = 2603): getpid() in the child returns its own PID, 2603. Line C (pid = 2603): In the parent, fork() returns the child's PID, 2603. Line D (pid1 = 2600): getpid() in the parent returns its own PID, 2600.
What is the exec system call?
The exec system call used right after fork enables the child process to execute a different program than the one it inherits from its parent process.
What is the act of a child process executing a different program than its parent called?
This act is referred to as an overlay.
What is mentioned about exec functions?
There is a family of exec functions, all of which have slightly different characteristics.
Where can one find more details about exec functions?
See the Linux manual for more details.
What is the first step in process creation?
Process creation using the fork and Exec system calls.
What happens to a process after executing the last statement?
A process is terminated.
What are the two ways a process can terminate?
Implicitly using the return statement or explicitly using the exit system call.
What happens to process resources after termination?
Process resources are deallocated by the operating system.
How may a parent terminate the execution of child processes?
A parent may terminate the execution of child processes using the abort system call.
What are some reasons a parent may terminate a child process?
Child has exceeded allocated resources or the task assigned to child is no longer required.
What happens if a parent process terminates?
Sometimes the operating system does not allow a child to continue if its parent terminates.
What does the OS do if the parent terminates?
The OS initiates cascading termination; all children, grandchildren, etc. are terminated.
How can a parent know the child's exit status?
The parent can know the child's exit status using the wait system call.
What does the wait system call return?
The wait system call returns status information and the pid of the terminated process.
What does Unix/Linux maintain regarding processes?
Unix/Linux maintains a table of processes which contains the list of all processes running and includes the process status.
What happens to a parent's entry in the process table if it terminates?
If a parent process terminates, its entry is removed from the table.
When is a child's entry in the process table removed?
A child's entry is removed from the table only after the parent process invokes a wait.
What is a zombie process?
If no parent is waiting and did not invoke wait, the process becomes a zombie.
What is an orphan process?
If a parent terminates without invoking wait, the process becomes an orphan.
What are the two types of processes within a system?
Processes within a system may be Independent or Cooperating.
What can affect a cooperating process?
A cooperating process can affect or be affected by other processes, including sharing data.
What are some reasons for cooperating processes?
Information sharing, computation speedup, modularity, and convenience.
What is needed for cooperating processes to communicate?
Cooperating processes need interprocess communication (IPC).
What are the two models of IPC?
The two models of IPC are Shared memory and Message passing.
What is Shared memory in IPC?
An area of memory shared among the processes that wish to communicate, where the communication is under the control of the user processes, not the operating system.
What are the advantages of Shared memory model?
It is used for sharing large amounts of data.
What are the major issues with the Shared Memory model?
The major issues are synchronizing process actions when accessing shared memory.
What does the operating system provide in the Message Passing model?
The operating system provides message passing capability.
What is a drawback of Message Passing compared to Shared Memory?
Message Passing requires system calls for every message transfer and is therefore slower.
What is an advantage of Message Passing?
It is simpler to set up and works well across multiple computers.
What is the significance of IPC in operating systems?
IPC is crucial for enabling communication and synchronization between processes.
Send to Chat
AI Edit
Normal Text
Highlight
Chapter 4
Study
What is a traditional process in terms of threading?
A traditional process has a single thread of control.
What distinguishes multi-threaded applications from traditional processes?
Multi-threaded applications have multiple threads within a single process.
What is the basic unit of CPU utilization when the operating system supports threads?
A thread is a basic unit of CPU utilization.
How does the weight of process creation compare to thread creation?
Process creation is many times heavy weight, while thread creation is light weight.
What are the components of each thread?
Each thread consists of: 1. Thread ID 2. Program Counter 3. Set of registers 4. Stack.
What do threads share within a process?
Threads share other components of the process such as code, data, and files.
Provide an example of multi-threading in word processing applications.
In editing a word document, different threads interpret keystrokes, display images, check spelling and grammar, and perform automatic backups periodically.
Why are many operating system kernels multi-threaded?
Many operating system kernels are multi-threaded to allow each thread to perform a specific task within the kernel process.
List the advantages of using threads.
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.
What does parallelism imply in computing?
Parallelism implies a system can perform more than one task simultaneously.
What does parallelism involve on a multi-core system?
Parallelism on a multi-core system involves the ability to execute multiple tasks across different cores.
What is concurrency in computing?
Concurrency supports more than one task making progress.
How does a single processor/core scheduler provide concurrency?
A single processor/core scheduler provides concurrency by managing the execution of multiple tasks, allowing them to make progress in overlapping time periods.
Is it possible to have concurrency without parallelism?
Yes, it is possible to have concurrency without parallelism.
What are some challenges faced in multicore programming?
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.
What are the two types of parallelism in multicore programming?
The two types of parallelism in multicore programming are Data parallelism and Task parallelism.
What is data parallelism?
Data parallelism distributes subsets of the same data across multiple cores, performing the same operation on each subset.
Can you provide an example of data parallelism?
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.
What is task parallelism?
Task parallelism involves distributing threads across cores, with each thread performing a unique operation.
Can you give an example of task parallelism?
An example of task parallelism is the Windows word document example, where different threads perform unique operations on the document.
What is the relationship between multicore systems and programmer challenges?
Multicore or multiprocessor systems put pressure on programmers due to the increased complexity of managing concurrency, data dependencies, and optimizing performance.
What does Amdahl's Law identify?
Performance gains from adding additional cores to an application that has both serial and parallel components.
What is the formula for Amdahl's Law in terms of serial portion S and processing cores N?
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).
In the context of Amdahl's Law, if an application is 75% parallel, what is the serial portion?
If an application is 75% parallel, the serial portion S is 25%, or S=0.25 in the formula.
What is the result of moving from 1 to 2 cores according to Amdahl's Law?
Moving from 1 to 2 cores results in a speedup of 16 times.
What happens to speedup as N approaches infinity according to Amdahl's Law?
As N approaches infinity, the speedup approaches 1.
What does Amdahl's Law suggest about adding more processes after a certain number?
Amdahl's Law suggests that adding more processes after a certain number has no effect on speedup.
What is a criticism of Amdahl's Law?
Some suggest that the formula does not account for hardware performance, therefore ceases to apply when N is high.
What relationship must exist between kernel and user level threads?
A relationship must exist between kernel and user level threads, as kernel level threads support the functioning of the kernel.
What must the operating system provide for user-created threads?
The OS must provide support to schedule and execute user-created threads on the CPU.
How does the OS support threads or processes?
The OS provides support by assigning kernel threads to a thread or a process.
What does the support provided by the OS depend on?
The support provided by the OS depends on the multithreading model adopted by the OS.
What are the multithreading models adopted by operating systems?
The multithreading models include Many to One, One to One, and Many to Many.
Describe the Many to One multithreading model.
In the Many to One model, all user-level threads created by the process are mapped to a single kernel thread.
Who handles thread management in the Many to One model?
Thread management is handled by the thread library in user space in the Many to One model.
What is a downside of the Many to One multithreading model?
If one thread blocks, all threads will block, and multiple threads may not run in parallel on a multicore system.
What is an example of a system that implemented the Many to One model?
An example of a system that implemented the Many to One model is the Green Threads Library available for Solaris.
What is the One to One model in threading?
Each user level thread is mapped to a kernel thread. Creating a user level thread creates a kernel thread to manage it.
What are the advantages and disadvantages of the One to One threading model?
It has more concurrency than Many to One but has maximum overhead. The number of threads per process is sometimes restricted due to overhead.
What are some examples of operating systems that use the One to One threading model?
Examples include Windows, Linux, and Solaris 9 and later.
What is the Many to Many threading model?
This model allows many user level threads to be mapped to an equal or smaller number of kernel threads. Users have no restrictions on the number of threads created.
What are the effects of blocking kernel system calls in the Many to Many model?
Blocking kernel system calls do not block the entire process.
How do processes with threads benefit in the Many to Many model?
Processes with threads can be split across multiple processors.
How are kernel threads allocated in the Many to Many model?
Individual processes may be allocated variable numbers of kernel threads depending on the number of CPUs present and other factors.
What is an example of an operating system that uses the Many to Many threading model?
An example includes Solaris prior to version 9.
What is the Two Level model in threading?
The Two Level model is a variation of Many to Many, allowing a user thread to be bound to a kernel thread.
How is user level threads management done?
User level threads management is done by a user level threads library in user space.
How are kernel level threads managed?
Kernel level threads are managed by the Kernel in kernel space.
What is the support for thread management in general purpose operating systems?
Virtually all general purpose operating systems have thread support, e.g., Windows, Solaris, Linux, Tru64 UNIX, Mac OS X.
What does a thread library provide to programmers?
A thread library provides an API for creating and managing threads.
What are the two primary ways of implementing thread libraries?
1. Library entirely in user space – involves API functions implemented solely within user space with no kernel support. 2. Kernel level library supported by the OS – involves system calls and requires a kernel with thread library support.
What are the three main thread libraries in use today?
1. POSIX Pthreads 2. Win32 threads 3. Java threads
What is POSIX Pthreads?
A POSIX standard API for thread creation and synchronization that may be provided as either a user or kernel library.
What is the specification of Pthreads?
The API specifies the behavior of the thread library, while the implementation is up to the development of the library.
On which operating systems is Pthreads commonly used?
Pthreads is common in UNIX operating systems including Solaris, Linux, and Mac OS X.
What model does the pthread library implement on Linux?
The pthread library implements the 1:1 model.
What must you include in your C program to create threads using Pthreads?
You need to include the pthread.h header file.
What type is used for creating thread IDs in Pthreads?
The pthread_t data type.
How should thread attributes be created or modified in Pthreads?
Using the pthread_attr_t data structure.
What function is used to create threads in Pthreads?
The pthread_create function.
What function must be used to ensure the parent thread outputs the sum after all summing threads have exited?
The pthread_join function.
How does Linux treat processes and threads?
Linux treats processes and threads the same, referring to them as tasks.
What system call is used for thread creation in Linux?
The clone system call.
What are some flags that can be set when using the clone system call?
1. CLONE_FS 2. CLONE_VM 3. CLONE_SIGHAND 4. CLONE_FILES
What does the CLONE_FS flag do?
Filesystem information is shared.
What does the CLONE_VM flag do?
The same memory space is shared.
What does the CLONE_SIGHAND flag do?
Signal handlers are shared.
What does the CLONE_FILES flag do?
The set of open files is shared.
What is Implicit Threading?
Implicit Threading is when the creation and management of threads is done by compilers and runtime libraries rather than programmers.
What are three methods of Implicit Threading explored?
1. Thread Pools 2. OpenMP 3. Grand Central Dispatch.
Send to Chat
AI Edit
Normal Text
Highlight
Chapter 5 - CPU Scheduling
Study
What is the primary resource that the Operating System schedules?
The CPU is the primary resource that the Operating System schedules.
What is central to Operating System design regarding CPU utilization?
Scheduling processes to execute on the CPU is central to Operating System design.
Why is maximizing CPU utilization feasible?
Maximizing CPU utilization is feasible as processes alternate using the CPU and waiting for I/O.
What are the two types of bursts in process execution?
The two types of bursts in process execution are CPU burst and I/O burst.
What characterizes an I/O bound program?
An I/O bound program typically has many short CPU bursts.
What characterizes a CPU bound program?
A CPU bound program might have a few long CPU bursts.
Why is the distribution of I/O bound and CPU bound programs important?
The distribution of I/O bound and CPU bound programs is important in the selection of an appropriate CPU scheduling algorithm.
What does the Operating System maintain for process scheduling?
The Operating System maintains scheduling queues of processes.
What is a job queue?
A job queue is a set of all processes in the system.
What is a ready queue?
A ready queue is a set of all processes residing in main memory that are ready and waiting to execute.
What are device queues?
Device queues are sets of processes waiting for an I/O device, usually with a separate device queue for each device.
What does the process scheduler do?
The process scheduler selects a process from a queue by implementing an appropriate scheduling algorithm.
What does the queueing diagram represent in process scheduling?
The queueing diagram represents queues, resources, and flows in the representation of process scheduling.
What is a CPU scheduler?
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.
When is the short term scheduler invoked?
The short term scheduler is invoked frequently, typically every few milliseconds, and must be fast.
What are the two types of scheduling?
Non-preemptive scheduling and Preemptive scheduling.
What is non-preemptive scheduling?
In non-preemptive scheduling, a running process is executed till completion without interruption.
What is preemptive scheduling?
In preemptive scheduling, a running process may be interrupted and moved to the ready queue by the operating system.
What is the role of the dispatcher?
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.
What is dispatch latency?
Dispatch latency is the time taken by the dispatcher to stop one process and start another process onto the CPU.
What is the scheduling criterion: CPU utilization?
CPU utilization aims to keep the CPU as busy as possible.
What is throughput in the context of CPU scheduling?
Throughput refers to the number of processes that complete their execution per time unit.
What is waiting time?
Waiting time is the amount of time a process has been waiting in the ready queue.
How is average waiting time calculated?
Average waiting time is calculated as the total waiting time of all processes divided by the total number of processes.
What is turnaround time?
Turnaround time is the amount of time to execute a particular process.
What components make up turnaround time for a process?
Turnaround time for a process is the sum of waiting time and CPU burst time.
What are the scheduling criteria for operating systems?
Maximize CPU utilization and throughput; Minimize turnaround time and waiting time.
What is a Gantt Chart?
Bar chart that illustrates a particular process schedule including the start and finish times of each of the participating processes.
What is the First Come First Serve (FCFS) Scheduling?
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.
What is the disadvantage of FCFS scheduling?
The disadvantage of FCFS scheduling is that the average CPU waiting time for a process to use the CPU is long.
What is the turnaround time for a process in FCFS scheduling?
Turnaround time for a process is calculated as: Waiting time + CPU burst time.
List the scheduling algorithms mentioned in the text.
First Come First Serve (FCFS), Shortest Job First (SJF), Shortest Remaining Time First, Priority Scheduling, Round Robin Scheduling.
What does FCFS stand for in scheduling?
First-Come, First-Served.
What is the convoy effect in scheduling?
It refers to a situation where short processes are delayed behind long processes, resulting in lower resource utilization.
What does SJF stand for in scheduling?
Shortest Job First.
What does SJF use to schedule processes?
SJF uses the lengths of the next CPU bursts to schedule the process with the shortest CPU burst.
How does SJF handle ties when two processes have the same next CPU burst?
FCFS scheduling is used to break the tie.
Why is SJF considered optimal?
SJF is optimal because it gives the minimum average waiting time for a given set of processes.
What is the preemptive version of SJF called?
Shortest Remaining Time First.
What does the Shortest Remaining Time First algorithm do?
At a given time, the process with the shortest remaining time is scheduled first.
What factors are introduced in the analysis of Shortest Remaining Time First?
Varying arrival times and preemption.
What is Multilevel Queue Scheduling?
Multilevel Queue Scheduling is a type of scheduling where the ready queue is partitioned into various separate queues. Each process resides permanently in a given queue, and each queue has its own scheduling algorithm.
What is the scheduling methodology used in Multilevel Queue Scheduling?
In Multilevel Queue Scheduling, scheduling is done between the queues using fixed priority preemptive scheduling, where processes of the highest priority are served first.
What is a disadvantage of Multilevel Queue Scheduling?
A disadvantage of Multilevel Queue Scheduling is that it is inflexible, as processes are permanently assigned to a given queue.
What is the difference between Multilevel Queue Scheduling and Multilevel Feedback Queue Scheduling?
In Multilevel Queue Scheduling, a process resides permanently in a specified queue, whereas in Multilevel Feedback Queue Scheduling, a process can move between various queues.
How can aging be implemented in Multilevel Feedback Queue Scheduling?
Aging can be implemented in Multilevel Feedback Queue Scheduling by moving a process from a low priority queue to a high priority queue.
What is the significance of thread scheduling in relation to kernel threads?
When threads are supported by the kernel, threads are scheduled instead of processes. User-level threads must be mapped to an associated kernel-level thread to run on the CPU.
What do POSIX Pthreads allow during thread creation?
POSIX Pthreads allows setting scheduling parameters during thread creation.
What is a potential issue that can occur in fixed priority preemptive scheduling?
A potential issue that can occur in fixed priority preemptive scheduling is starvation, where lower priority processes may not get executed.
What is associated with each process in Priority Scheduling?
A priority number integer.
How are processes with equal priority scheduled in Priority Scheduling?
In FCFS (First-Come, First-Served) order.
How is the CPU allocated in Priority Scheduling?
The CPU is allocated to the process with the highest priority, which is the smallest integer.
What are the two types of Priority Scheduling?
Preemptive and non-preemptive.
What problem may occur with low priority processes in Priority Scheduling?
Starvation; low priority processes may never execute.
What is the solution to starvation in Priority Scheduling?
Aging; as time progresses, increase the priority of the process.
How does Round Robin (RR) scheduling differ from FCFS scheduling?
RR scheduling includes preemption to enable the system to switch between processes.
How are processes scheduled in Round Robin scheduling?
Processes are scheduled on a FCFS basis from the ready queue, where each process gets a small unit of CPU time, known as time quantum (q).
What happens when the time quantum has elapsed in Round Robin scheduling?
The process is preempted and added to the end of the ready queue.
What triggers the scheduling of the next process in Round Robin scheduling?
Timer interrupts every quantum.
What is the typical average turnaround time comparison of Round Robin and SJF?
Typically higher average turnaround time than SJF (Shortest Job First).
What should the value of q be in Round Robin scheduling?
q must be large with respect to context switching time; otherwise, overhead is too high.
What is the usual range for the time quantum (q) in Round Robin scheduling?
10 to 100 milliseconds.
What is the context switch time in Round Robin scheduling?
10 microseconds.
Scholarly Assistant's Insights
Learn the basics of Operating Systems, their goals, structure, and key roles in computing.
Operating Systems
Computer Science
Programming
Technology
Software Development
+11 more
Ask Scholarly Assistant
Similar Pages
Login to Leave a Comment
Give your feedback, or leave a comment on a page to share your thoughts with the community.
Login