OS Midterm

0.0(0)
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/221

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

222 Terms

1
New cards

What are the objectives of the lecture on the history of operating systems?

  1. Describe the generations of operating systems and their influences.\n2. Analyze effects of multiprogramming vs. uniprogramming.\n3. Identify components and central abstractions of OS.

2
New cards

What is an Algorithm?

A set of instructions with finite initial store and state, a starting point, and unambiguous ordering until the endpoint (halt point).

3
New cards

What is a Program?

The sequence of instructions that embody an algorithm. It can be the Source code or Machine Code.

4
New cards

What is a Process?

A program in execution plus its Process State. These are represented by the current instruction, state of memory, and resources.

5
New cards

What is a Job?

A task to be completed. Often a program or a collection of programs awaiting execution.

6
New cards

Difference between 'Process' and 'Job'?

The words 'process' and 'job' are often used interchangeably in practice, but they are slightly different. A 'Job' is often a program or a collection of programs awaiting execution, while a 'Process' is a program in execution.

7
New cards

Why do we need an Operating System?

To help with repetitive or complex tasks such as loading a program, which can involve a series of precise but repetitive tasks.

8
New cards

What is the Altair 8800?

An example of an old computer that did not have an Operating System. Programs had to be loaded manually before execution.

9
New cards

How does the OS help in accessing I/O devices?

The OS provides a uniform interface to access input and output devices and often standardizes input and output routines.

10
New cards

What safety features does the OS provide?

The OS restricts access to read/write routines to users and processes, preventing unauthorized access to resources.

11
New cards

What are the primary jobs of an OS?

  1. Resource Manager\n2. To provide an extended machine to the user.

12
New cards

What does the OS do as a Process Manager?

It switches between multiple programs and processes, giving the illusion that they are executing at the same time.

13
New cards

What does the OS do as a Memory Manager?

It decides which programs to load to main memory, which to keep on fixed storage, and which to load into cache memory.

14
New cards

What are the three large groups of OSs?

  1. Interactive OSs\n2. Batch OSs\n3. Real-time OSs

15
New cards

What characterized the first generation of computers (1945-1955)?

  1. Users were also operators.\n2. Programs were represented by wiring instructions into physical boards.\n3. Ran a single program at a time.

16
New cards

What characterized the second generation of computers (1955-1965)?

  1. Built with transistors.\n2. Introduced batch systems.\n3. Users/programmers were not operators.

17
New cards

What is the difference between Uniprogrammed and Multiprogrammed systems?

Uniprogrammed systems run a single program at any given time. Multiprogrammed systems aim to keep the CPU busy by utilizing a pipeline approach.

18
New cards

What characterized the third generation of computers (1965-1980)?

  1. Built with Integrated Circuits.\n2. Introduced Timesharing systems.\n3. Users developed software directly using terminals.

19
New cards

What are the limitations and constraints in the history of OSs?

Old computers had very limited memory and storage. As computers evolved, these limitations were overcome, but they became relevant again with the advent of wearables and embedded computers.

20
New cards

What is not part of an OS?

  1. The user interface is not part of the OS.\n2. System Tools are not part of the OS.\n3. Libraries utilized by the OS are not part of the OS.

21
New cards

How did the role of 'programmer' and 'operator' evolve over generations?

In the first generation, users were also operators. In the second generation, the roles separated. By the third generation, users developed software directly using terminals, effectively becoming operators again.

22
New cards

What is the role of OS in multitasking?

The OS manages resources, protects private information, and facilitates interactions between multiple users, processes, and programs, enabling multitasking.

23
New cards

How does the OS fit in the organization of a typical personal computer system?

The OS is the layer of software that exists between the hardware and the user-interface program.

24
New cards

What are the additional OS concepts covered in the video?

Named Calls, including Procedure and System calls.

25
New cards

What resources does the OS manage?

  1. CPU time allocated to each process.\n2. Working memory (or main memory).\n3. Storage (fixed/removable disks or SSDs).\n4. Device Input and Output.

26
New cards

What are Files in the context of OSs?

Files are logically named persistent storage. They can be text, video, or audio files. They also serve as a paradigm for I/O devices and data communication.

27
New cards

What is a Process in the context of OSs?

A process is a program in execution. It occupies some address space and is associated with specific resources like data, stack, pointers, and files.

28
New cards

How do File Systems work in OSs?

File Systems define how data is stored, have mounting schemes, implement strategies to name files and store them in folder or directory trees, and may provide advanced features like data redundancy and networking capabilities.

29
New cards

How are disks identified in Windows and Unix OSs?

In Windows, disks are identified by letters (e.g., C:). In Unix systems, they appear as directories, usually inside the mnt (mount) directory.

30
New cards

How does a process read from a disk?

A process issues a system call to the OS, which then executes the disk access and returns the requested information to the application program.

31
New cards

What is a Process in terms of its components?

A process is a program in execution that occupies some address space and is associated with specific resources like data, stack, pointers, and files.

32
New cards

How are Processes organized?

Processes are organized in trees, where each process has a parent and may have one or multiple children.

33
New cards

What are Threads in the context of Processes?

Threads are a way to save memory when you need multiple processes executing the same set of instructions.

34
New cards

What are Named Calls?

Named calls are divided into Procedures and System Calls.

35
New cards

What are Procedures?

Procedures are named code with local variables and parameters. They execute completely in User Space in the OS.

36
New cards

What are the segments of a process in memory?

  1. Text: Code the process is executing.\n2. Data: Static and dynamic variables.\n3. Stack: Activation frames of the calls made.

37
New cards

How is memory allocated for a process?

Memory for the process is allocated so that there is empty (Gap) memory for the data and stack to grow.

38
New cards

What happens when a procedure call is made?

A new stack frame is added to the call stack, which contains all the information needed for the procedure to execute and return.

39
New cards

What is a System Call?

A named call that involves a context switch into kernel mode for execution. Needed to execute protected instructions like reading or writing from a disk.

40
New cards

How is a System Call initiated?

The user program calls a System Library procedure, which then stores parameters and a System call number in predetermined memory areas, and issues a kernel trap.

41
New cards

What is the role of the OS Dispatcher in System Calls?

The Dispatcher reads the system call number from memory and uses it to look up a vector table that has pointers to code that can carry out each possible system call.

42
New cards

What is POSIX?

A set of formal descriptions that provide a standard for the design of operating systems, especially ones compatible with Unix.

43
New cards

Examples of POSIX standard System Calls for process management?

Fork, to create child processes, and Exit, to terminate a process.

44
New cards

Examples of POSIX standard System Calls related to file operations?

Open, Close, Read, Write, and Lseek.

45
New cards

What is a Hardware Interrupt?

A Hardware Interrupt is a signal sent by a hardware device to the CPU to interrupt the current flow of execution.

46
New cards

How does a hardware device signal an Interrupt Request (IRQ)?

The device 'raises a line,' meaning a wire from the device connected to the main board goes from zero volts to typically +3 volts. The interrupt controller senses this raised voltage and interprets it as an Interrupt Request.

47
New cards

What is the role of the Interrupt Controller?

The Interrupt Controller manages interrupt requests from various hardware devices. Upon receiving a request, it sends a signal to the CPU to interrupt the current sequence of instructions.

48
New cards

How does the CPU acknowledge an interrupt?

"The CPU sends a signal back to the Interrupt Controller acknowledging the interrupt. The Interrupt Controller then responds back with an interrupt number (IRQ#)."

49
New cards

"What is the purpose of the IRQ#?"

"The IRQ# is used to let the OS know how to treat the interrupt. For example, it may indicate what to do when a reading operation from a disk is complete."

50
New cards

How are interrupts managed in multicore systems?

On multicore systems, the interrupt controller can be programmed to send different interrupts to different processor cores.

51
New cards

What are the steps to treat an Interrupt Request?

"1. The I/O device issues a hardware interrupt.\n2. The current instruction is interrupted, and the OS switches to kernel mode.\n3. The Dispatcher uses the IRQ# to find the correct handler via the Interrupt Service Routine (ISR).\n4. The handler is executed, informing the process that the requested operation is complete.\n5. Control is returned to the scheduler for new process scheduling."

52
New cards

What is an Interrupt Mask?

An Interrupt Mask is a binary value stored on a register in the interrupt controller. It determines which signals the controller listens to.

53
New cards

How are multiple interrupts managed?

If another interrupt arrives during an ongoing interrupt routine, the interrupt controller mask will block the new request until the previous one is treated.

54
New cards

What does 'restoring interrupts' mean?

Restoring interrupts involves remembering old mask values and restoring them, allowing the interrupt controller to listen to new interrupts.

55
New cards

When does the OS check for interrupts?

The OS checks for interrupts typically before each FETCH, DECODE, and EXECUTE cycle.

56
New cards

What are Precise Interrupts?

Precise Interrupts are treated after an instruction is completed and before another is started. They have a known program counter state, and all preceding instructions are fully executed.

57
New cards

What are Imprecise Interrupts?

Imprecise Interrupts are treated even if instructions are left incomplete or partially executed. They may have close to zero wait time but add complexity in stopping and restarting instructions.

58
New cards

What is the difference between how system calls and interrupts trap the OS into Kernel space?

During a system call, the OS is trapped into Kernel space by a system library call. During an interrupt, it is triggered by raising the interrupt line between the interrupt controller and the CPU.

59
New cards

What are the two main types of OS architectures?

Microkernel and Monolithic Kernel.

60
New cards

How do Microkernel and Monolithic Kernel architectures differ?

Microkernel has only core functionalities in kernel space and most modules in user space. Monolithic Kernel has all modules in kernel space.

61
New cards

What are the advantages of Microkernel architecture?

Modules communicate via message passing, most operations don't require system calls, and changes to modules don't require the OS to be re-compiled. Commonly used in OS research.

62
New cards

What are the characteristics of Monolithic Kernel architecture?

All modules like file system, device drivers, and task management are in kernel space. Any change requires recompilation of the entire OS. File system operations require system calls.

63
New cards

What is a process?

A program in execution. It is loaded into main memory and has its own pointers, counters, and variables.

64
New cards

How is an executable program represented in memory?

An executable has a Header, Text, Data, and Symbols. The Header contains metadata, Text contains instructions, Data contains constants and variables, and Symbols are metadata about addresses.

65
New cards

How is a process represented in memory?

The process has Text and Data loaded from the executable. It also has a Heap for dynamic allocations and a Stack for procedure calls and local variables. Some free, empty memory is also allocated.

66
New cards

How does the memory space of a process grow?

The Stack grows down and the Heap grows up inside the process memory space.

67
New cards

What is the 'process model'?

A model that dictates how processes are created, executed, and terminated. Processes have at least one thread of execution, program counter, allocated memory space, stack, and program pointers. They also have independence of execution.

68
New cards

What is PSEUDOPARALLELISM?

It imitates parallel execution even with just a single processor. Processes take turns using the CPU for a small amount of time, known as a QUANTUM.

69
New cards

What happens when a process is 'preempted'?

The process is removed from the CPU so that another process can be scheduled and executed.

70
New cards

How is pseudoparallelism achieved?

After each quantum, the OS swaps processes by saving the state of the running process and loading the state of the next process to execute.

71
New cards

Where are the contents of CPU registers stored during a process swap?

In main memory or on fixed storage like a hard disk or SSD.

72
New cards

How are processes created and terminated in Unix systems?

The first process is created by the 'init' call during system initialization. Other processes are created by the 'fork' system call. Processes can be terminated voluntarily or involuntarily.

73
New cards

What is the Process Control Block (PCB)?

A data structure in main memory that contains information needed to manage processes, such as register values, states, text, data, heap, and stack pointers, and file descriptors.

74
New cards

What is the role of the OS Scheduler?

The Scheduler handles process scheduling, chooses which process to run next, responds after interrupts, and balances the needs of all processes to prevent starvation.

75
New cards

How is the Scheduler scheduled to run?

The OS enters kernel mode, removes the old process from the CPU, loads a new process into the CPU registers, sets an alarm for a quantum of time, and switches back to User mode. When the alarm goes off, the Scheduler is executed.

76
New cards

What are the different states a process can be in?

Running, Ready, Blocked, Swapped Out & Blocked, Swapped Out & Ready, Initializing, and Exiting.

77
New cards

What does 'Swapped Out' mean for a process?

The process is not in main memory but has been saved in fixed storage like a hard drive.

78
New cards

What is a 'context switch'?

It occurs when the CPU switches between two processes. The context of the CPU (content of its registers) is replaced with new information for the new process.

79
New cards

What causes a context switch?

I/O operations, wait or sleep operations, pseudoparallelism, asynchronous events like hardware interrupts, Signals, and Exceptions.

80
New cards

What steps are involved in a context switch?

Store register values in main memory, keep track of allocated memory addresses, and update the process state in the PCB.

81
New cards

What are Signals in the context of OS?

Signals are generated by system calls and are used to pass messages to a process. They can be issued by the Kernel or other processes.

82
New cards

How are Signals treated?

If a handler is registered in the PCB, the signal is stored and the handler is queued to execute. If no handler is registered, the target process is terminated.

83
New cards

What is a Segmentation Fault?

A signal issued by the Kernel when a process tries to allocate a memory area not allowed by the OS. The process may catch the signal or be terminated.

84
New cards

What is the Sigkill signal?

A signal that cannot be treated. If a process receives this signal, it will be terminated.

85
New cards

What is a single-threaded process?

A single-threaded process is a program in execution with allocated memory areas for code, data, and files. It has a single program counter, or thread of execution.

86
New cards

What is a multithreaded process?

A multithreaded process has multiple threads of execution, each with its own register information and stack. However, all threads share the code, data, and file descriptors.

87
New cards

What are Lightweight processes?

Threads are often referred to as 'Lightweight processes' because they share code, data, and files but have individual register and stack information.

88
New cards

What is shared between threads in a multithreaded process?

Code, data, and file descriptors are shared between threads.

89
New cards

What is unique to each thread in a multithreaded process?

Each thread has its own program counter, register information, stack entries, and state.

90
New cards

Why are threads used?

Threads are used to avoid wasting memory with repeated information and to break up complicated tasks into simpler ones for improving efficiency.

91
New cards

What are User-space threads?

User-space threads are OS-independent and run in user-space. The OS and its scheduler are not aware of them. They are managed by thread libraries specific to programming languages.

92
New cards

What are Kernel-space threads?

Kernel-space threads are part of the OS and run in kernel mode. The OS scheduler is aware of them and can schedule each thread individually.

93
New cards

What are Hybrid threads?

Hybrid threads combine user-space and kernel-space threads. They can get complex and are better suited for specific optimizations.

94
New cards

What are the two main strategies for inter-process communication?

Shared Memory and Message Passing.

95
New cards

What is Shared Memory in inter-process communication?

Processes or threads read and write directly to a shared memory space. This strategy requires explicit synchronization.

96
New cards

What is Message Passing in inter-process communication?

Data parcels are accepted and delivered between processes. Two common approaches are pipes (local only) and network sockets (between hosts).

97
New cards

What is a race condition?

A race condition occurs when a process or thread attempts to perform two or more operations at the same time, but the operations must be done in the proper sequence to be done correctly.

98
New cards

What are Critical Regions?

Critical regions are areas of code that must be protected from interruptions to avoid race conditions. Operations inside critical regions must be atomic.

99
New cards

What properties must be maintained to avoid race conditions?

Concurrency, Safety, and Liveness. Concurrency means no assumptions about speed or number of CPUs. Safety means no two processes may be simultaneously within their CRs. Liveness means no process outside of the CR may block other processes inside it, and no process should wait forever to enter its CR.

100
New cards

What are the two primary synchronization criteria?

Safety and Liveness.