Operating system CH1&2

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/181

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 12:44 PM on 9/15/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

182 Terms

1
New cards

What are the two core jobs of an operating system?

Provide abstractions that make hardware usable and provide control that manages resources safely and correctly.

2
New cards

What is OS abstraction?

Hiding complex hardware details and presenting simpler concepts such as files, processes, virtual memory, and sockets.

3
New cards

How does a process act as an abstraction?

It hides direct CPU control and makes a running program appear to have its own execution context.

4
New cards

How does virtual memory act as an abstraction?

It hides raw physical addresses and presents programs with a protected virtual address space.

5
New cards

What does the OS do as an extended or virtual machine?

It hides inconvenient hardware details, offers stable high-level operations, and creates useful illusions such as many processes and large memory.

6
New cards

What does the OS do as a resource manager?

It tracks ownership and availability, schedules and allocates resources, and resolves conflicts using policies.

7
New cards

What is the difference between mechanism and policy?

Mechanism answers how something is done; policy answers which choice should be made.

8
New cards

What are the five major OS responsibility areas?

Processes, memory, storage, devices, and security.

9
New cards

What does the OS do for processes?

Create, schedule, synchronize, and terminate them.

10
New cards

What does the OS do for memory?

Allocate, protect, map, and reclaim memory.

11
New cards

What does the OS do for storage?

Name, organize, persist, and retrieve data.

12
New cards

What does the OS do for devices?

Control, buffer, cache, and abstract devices.

13
New cards

What does the OS do for security?

Authenticate, authorize, isolate, and audit.

14
New cards

What is the main goal of batch systems?

Throughput; jobs run in groups with little interaction.

15
New cards

What is the main goal of multiprogramming?

CPU utilization by keeping several jobs in memory so another can run while one waits.

16
New cards

What is the main goal of time-sharing?

Responsiveness by rapidly switching the CPU among interactive users or tasks.

17
New cards

What is the defining goal of a real-time system?

Deadline correctness: results must arrive within required timing constraints.

18
New cards

What is characteristic of embedded/RTOS environments?

Limited memory and power with strict deterministic timing; minimal footprint and guaranteed response are emphasized.

19
New cards

What is characteristic of mobile operating systems?

Battery preservation, variable connectivity, many sensors, touch interaction, background suspension, and strong app sandboxing.

20
New cards

What is characteristic of server/enterprise operating systems?

High throughput, high availability, scalable multicore processing, networking, virtualization, and often headless management.

21
New cards

What are the basic hardware components coordinated by the OS?

CPU/cores, RAM, storage, network, display, input devices, and the system interconnect/bus.

22
New cards

What is the difference between RAM and storage?

RAM holds active instructions/data temporarily; storage retains information persistently.

23
New cards

What is a device controller?

Hardware that operates a specific device, exposes command/register interfaces, buffers transfers, and reports completion or errors.

24
New cards

What is a device driver?

OS software that translates generic OS requests into device-specific operations for a controller.

25
New cards

Device controller vs. device driver?

The controller is hardware; the driver is software.

26
New cards

What is the stored-program (von Neumann) architecture?

Instructions and program data are both stored in memory for the CPU to fetch and execute.

27
New cards

What are the main stages of the CPU instruction cycle?

Fetch, decode, execute, write back/update, then check for events such as interrupts.

28
New cards

What does the program counter (PC) identify?

The address of the next instruction to execute.

29
New cards

How do interrupts affect the normal instruction cycle?

They can redirect execution to an OS handler so the system can respond to an event.

30
New cards

Shared-memory vs. distributed-memory systems?

Shared-memory systems communicate with loads/stores in one address space; distributed-memory nodes have private memory and communicate with messages.

31
New cards

What is multicore?

Multiple execution cores within one processor package.

32
New cards

What is dual-mode operation?

A protection model that separates restricted application execution in user mode from privileged OS execution in kernel mode.

33
New cards

What runs in user mode?

Ordinary applications with restricted hardware and memory access.

34
New cards

What runs in kernel mode?

The OS kernel and commonly device drivers, with privileged access to hardware and protected system resources.

35
New cards

Why is a user-mode application crash usually less severe than a kernel failure?

User-mode failures are normally isolated; kernel-mode failures can affect the entire system.

36
New cards

What records the CPU's current privilege level?

The CPU mode bit or equivalent hardware privilege state.

37
New cards

Give four categories of privileged instructions.

I/O control, memory control, interrupt control, and processor control.

38
New cards

What happens if user-mode code attempts a privileged instruction?

The hardware raises an exception and transfers control to the kernel.

39
New cards

Why is the hardware timer important for OS control?

It guarantees the OS can regain control from a running program through a timer interrupt.

40
New cards

What is the basic system-call privilege transition?

User prepares arguments → trap instruction → kernel mode → kernel validates/performs service → return to user mode.

41
New cards

Why can't applications directly access hardware?

Direct access could cause conflicting commands, memory corruption, disabled interrupts, or exposure of protected data.

42
New cards

What is a hardware interrupt?

An asynchronous event from external hardware, such as input, I/O completion, network arrival, or timer expiration.

43
New cards

What is an exception/fault?

A synchronous event caused by the currently executing instruction, such as divide by zero, invalid opcode, page fault, or protection violation.

44
New cards

What is a trap?

An intentional synchronous software event used for controlled kernel entry, such as a system call or breakpoint.

45
New cards

Interrupt vs. exception?

An interrupt is external and asynchronous; an exception comes from the current instruction and is synchronous.

46
New cards

What are the main steps of interrupt handling?

Detect event → save PC/minimal state → use interrupt vector to locate handler → service cause → restore state and resume.

47
New cards

What is an interrupt vector?

A mapping from event/interrupt numbers to handler entry points.

48
New cards

What is a system call?

The kernel's controlled interface for a program to request a protected OS service.

49
New cards

What are major categories of system calls?

Process, file, device, information, communication, and protection operations.

50
New cards

What does a library wrapper do for a system call?

It provides a convenient language-level function, prepares the system-call number/arguments, and performs controlled kernel entry.

51
New cards

API vs. system call?

An API is an application-facing programming contract; a system call is the low-level protected kernel-entry mechanism.

52
New cards

Can an API call avoid a system call?

Yes. An API call may remain in user space or invoke zero, one, or multiple system calls.

53
New cards

What is a mode switch?

A change in CPU privilege level, such as user mode to kernel mode, while the same process/thread may continue.

54
New cards

What is a context switch?

A change in the running process or thread that requires saving old CPU state and restoring another execution context.

55
New cards

Does every system call cause a context switch?

No. A system call causes controlled kernel entry (a mode switch), but the same process may resume without the scheduler choosing another process.

56
New cards

What happens when read(fd, buffer, n) is called?

Wrapper arranges arguments → trap enters kernel → kernel validates fd/buffer/permissions → data is returned or process blocks for I/O → result/error returns.

57
New cards

What can read() return?

A positive byte count, 0 for end-of-file, or -1 for an error.

58
New cards

What is a monolithic kernel?

An architecture where major OS services run together in one privileged kernel address space and can call each other directly.

59
New cards

Why can monolithic kernels be fast?

Kernel subsystems can communicate through direct procedure calls with fewer protection-boundary crossings, context switches, and message-passing costs.

60
New cards

What is the main risk of a monolithic kernel?

A faulty or compromised kernel component can corrupt shared kernel memory or crash/compromise the whole system.

61
New cards

What is a microkernel?

A design that keeps a small privileged core—such as scheduling, IPC, and basic memory management—while services run outside the kernel and communicate by messages.

62
New cards

What is the main advantage of a microkernel?

Stronger isolation and a smaller trusted privileged core, improving fault containment and security.

63
New cards

What trade-off can microkernels introduce?

More protection-boundary crossings and message passing can increase overhead.

64
New cards

What is a modular kernel?

A fundamentally monolithic kernel that can dynamically load or remove kernel-space modules such as drivers or file systems.

65
New cards

Does a loadable kernel module run in user space?

No. Modules still execute in kernel space, so a faulty module can damage the system.

66
New cards

What is a hybrid kernel?

A design combining ideas from monolithic and microkernel approaches to balance performance, flexibility, compatibility, and isolation.

67
New cards

What design pressure tends to move more services into kernel space?

Performance: fewer crossings and copies.

68
New cards

What design pressure tends to favor a smaller privileged core?

Reliability and security through better fault containment and a smaller trusted computing base.

69
New cards

What is the high-level boot sequence?

Firmware → bootloader → kernel → user-space services → login/UI.

70
New cards

What does firmware do during boot?

BIOS/UEFI initializes hardware enough to locate and launch the next boot stage.

71
New cards

BIOS vs. UEFI?

BIOS is the legacy firmware interface; UEFI is the modern standard with richer services, boot entries/filesystem awareness, and Secure Boot support.

72
New cards

What does the bootloader do?

Selects an OS/kernel, loads the kernel and initramfs into memory, passes boot parameters, and transfers execution to the kernel.

73
New cards

Why must the bootloader load the kernel into RAM?

The CPU needs the kernel's executable instructions and working data in memory to begin executing it.

74
New cards

What does the kernel initialize before user space?

Memory management, CPU cores/timers/scheduler, devices/drivers, and the root filesystem.

75
New cards

What is the role of the initial user-space process?

It starts and manages the service ecosystem; on modern Linux this is commonly systemd.

76
New cards

Program vs. process?

A program is passive executable instructions on disk; a process is a running instance with a PID, address space, CPU state, and resources.

77
New cards

What is a PID?

A process identifier: a unique number for an active process that may be reused after the process terminates.

78
New cards

What is a daemon?

A background program that provides a system or network service, usually without direct user interaction.

79
New cards

What are the main regions of a process address space?

Text, data, heap, stack, plus free virtual-address space between growing regions.

80
New cards

What is stored in the text segment?

Executable machine instructions.

81
New cards

What is stored in the data segment?

Global and static variables.

82
New cards

What is stored in the heap?

Dynamically allocated memory; it traditionally grows toward higher addresses.

83
New cards

What is stored in the stack?

Function-call frames, parameters, return addresses, and local variables; it traditionally grows toward lower addresses.

84
New cards

What information/resources make up a process besides code?

CPU state, memory, open files, identity, IPC resources, and accounting information.

85
New cards

What do file descriptors 0, 1, and 2 normally represent?

0 standard input, 1 standard output, 2 standard error.

86
New cards

What is a parent-child process relationship?

The creating process is the parent; the created process is the child, has its own PID, and may inherit selected resources.

87
New cards

What are the five basic process states?

New, Ready, Running, Waiting/Blocked, and Terminated.

88
New cards

What does Ready mean?

The process is runnable and waiting for CPU time.

89
New cards

What does Running mean?

The process is currently executing on a CPU core.

90
New cards

What does Waiting/Blocked mean?

The process cannot run until an event such as I/O completion occurs.

91
New cards

Why does a waiting process usually return to Ready instead of directly to Running?

The scheduler must select it again before it can use the CPU.

92
New cards

What is Ready Suspended?

A logically runnable process that is suspended/not resident in main memory and must be restored before dispatch.

93
New cards

What is Blocked Suspended?

A suspended process that is still waiting for an event and may also be outside main memory.

94
New cards

What is a PCB?

The Process Control Block: the kernel's protected record containing the information needed to manage and resume a process.

95
New cards

What information is stored in a PCB?

Identity, CPU context (PC/registers), state, scheduling data, memory information, and accounting data.

96
New cards

Why must the PC and CPU registers be saved during a context switch?

So a preempted process can later resume exactly where it stopped with its working state restored.

97
New cards

What is in the ready queue?

Runnable processes waiting to be dispatched to a CPU.

98
New cards

What is in a device queue?

Processes blocked while waiting for a specific I/O operation to complete.

99
New cards

What steps occur during process creation?

Allocate PID/PCB, initialize address space/state, inherit selected files/attributes, and enqueue the child in the ready queue.

100
New cards

What does fork() do?

Creates a child process that begins from the same logical point; fork returns different values to parent and child.