



















Preview text:
lOMoAR cPSD| 58702377
📚 Tổng Hợp Lý Thuyết Hệ Điều Hành Theo Chủ Đề (Full)
🔴 1. Deadlock (Bế tắc)
✔️ 4 Điều kiện Deadlock:
1. Mutual Exclusion: Tài nguyên không chia sẻ.
2. Hold and Wait: Tiến trình giữ tài nguyên và chờ thêm.
3. No Preemption: Tài nguyên không bị thu hồi.
4. Circular Wait: Tồn tại chu trình chờ.
✔️ Phòng/Tránh/Phát hiện Deadlock: •
Prevention: Loại bỏ điều kiện. •
Avoidance: Dùng Banker’s Algorithm. •
Detection & Recovery: Cho phép xảy ra rồi hồi phục.
🟡 2. Critical Section & Synchronization •
Đảm bảo mutual exclusion khi nhiều tiến trình truy cập chung. 3 Tính chất cần: 1. Mutual Exclusion 2. Progress 3. Bounded Waiting Thuật toán: •
Peterson (cho 2 process), Bakery, Test-and-set, Dekker, Lamport’s Algorithm
🟢 3. Semaphore / Monitor / Spinlock Semaphore: • Binary (mutex) & Counting •
Thao tác: wait(S) & signal(S) Monitor: • High-level sync. •
Dùng wait() & signal() trên condition variables. Spinlock: •
Dạng “lock bận”, quay vòng tốn CPU, thích hợp đa lõi. lOMoAR cPSD| 58702377
🟣 4. Race Condition & Mutual Exclusion •
Race Condition: nhiều process truy cập dữ liệu chung → kết quả không xác định. •
Cách giải quyết: áp dụng mutual exclusion = semaphore, monitor, locks...
🟠 5. Resource Allocation & Banker’s Algorithm •
Đảm bảo trạng thái an toàn khi cấp tài nguyên. •
Các ma trận: Max, Allocation, Need = Max - Allocation, Available
💪 6. System Calls & Process Handling
Hệ thống gọi lệnh: •
fork(), exec(), wait(), exit(), kill(), getpid() Quản lý tiến trình: • PCB: Process Control Block • PID: Process ID • Orphan/Zombie process 🔹 7. CPU Scheduling Thuật toán: •
FCFS – First Come First Serve •
SJF / SRTF – Shortest Job / Remaining Time First • RR – Round Robin (quantum) •
Priority Scheduling – theo độ ưu tiên
🔺 8. I/O Management & File Systems Quản lý I/O: •
Buffering, Spooling, Device Controller File Systems: •
Cáu trúc file: directory, inode •
Allocation: contiguous, linked, indexed •
File attributes: name, type, location, size, permissions
🔻 9. Memory Management •
Paging: chia memory thành khối cố định (page/frame) •
Segmentation: chia theo logic: code, data, stack •
Virtual Memory: dùng disk làm RAM ảo •
Page replacement: FIFO, LRU, Optimal
🔼 10. Virtualization & Exokernel lOMoAR cPSD| 58702377 •
Exokernel: Kernel tối giản, trao nhiều quyền hướng tự do cho application. •
Virtual Machine: cho nhiều OS chạy trên cùng hardware (VMware, VirtualBox)
🔽 11. Security & Protection •
Access Matrix: giám sát ai được truy cập gì •
Authentication: password, token, biometrics •
Protection rings: kernel (ring 0) vs user (ring 3)
🛋️ 12. Hệ thống khởi động (Booting Process) •
BIOS/UEFI → Bootloader → Kernel → OS Init •
Bootstrap Program: chương trình đầu tiên khi bật máy lOMoAR cPSD| 58702377 ❓ Câu 1:
Which of the following conditions is not necessary for a deadlock to occur? A. Mutual exclusion
B. No preemptionC. Circular wait D. Context switch ❓ Câu 2:
Which one of the following is not a CPU scheduling algorithm? A. Round Robin B. Priority Scheduling C. First-Come First-Served D. Banker's Algorithm ❓ Câu 3:
Which of the following best describes a zombie process?
A. A process that is terminated but still has an entry in the process table.
B. A process that is running without a parent.
C. A process that is stuck in infinite loop.
D. A process that holds all system resources. ❓ Câu 4:
The initial value of a binary semaphore used for mutual exclusion is: A. 0 B. 1 C. -1 D. Any positive integer ❓ Câu 5:
Which of the following is used to handle deadlock prevention?
A. Grant resources immediately B. Allow circular wait
C. Request all resources at once D. Use FIFO scheduling ❓ Câu 6:
What is the main idea of the Round Robin (RR) scheduling algorithm?
A. Always run the process with shortest remaining time
B. Allocate CPU to process with highest priority
C. Allocate CPU in equal time slices in a circular order D. Allocate CPU randomly lOMoAR cPSD| 58702377 ❓ Câu 7:
Which of the following system calls is used to create a new process in UNIX? A. exec() B. fork() C. kill() D. wait() ❓ Câu 8:
A system is in a safe state if: A. Deadlock has occurred
B. The system can allocate resources in some order without deadlock
C. Only one process is running D. It uses paging ❓ Câu 9:
What is the role of paging in memory management? A. Prevent deadlock B. Increase CPU throughput
C. Allow non-contiguous memory allocation D. Decrease file size ❓ Câu 10:
Which of the following best defines a critical section?
A. A portion of code where I/O operations are performed
B. A portion of code that modifies shared data
C. A portion of code executed by the OS only
D. A portion of code for process creation ❓ Câu 11:
If a process is executing in its critical section, then no other processes can be executing in their critical section.
What is this condition called? A. Critical exclusion B. Asynchronous exclusion
C. Mutual exclusionD. Synchronous exclusion ❓ Câu 12:
In the bakery algorithm to solve the critical section problem:
A. Each process gets a unique number and the one with the lowest number is served next
B. Each process is put into a queue and picked up in an ordered manner
C. Each process receives a number (may or may not be unique) and the one with the lowest number is served next
D. Each process gets a unique number and the one with the highest number is served next ❓ Câu 13: lOMoAR cPSD| 58702377
Given a priori information about the ________ number of resources of each type that may be requested for
each process, it is possible to construct an algorithm that ensures that the system will never enter a deadlock state. A. Minimum B. Average C. Maximum D. Approximate ❓ Câu 14:
For a Hold and wait condition to prevail:
A. All resources must be requested at once
B. A process must be holding at least one resource and waiting to acquire additional resources that are being held by other processes
C. A process must wait for all its resources before holding any
D. Circular waiting must be enabled first ❓ Câu 15:
Which algorithm is used to avoid deadlock? A. Peterson’s Algorithm B. Round Robin Algorithm
C. Banker’s AlgorithmD. FIFO Scheduling Algorithm ❓ Câu 16:
Which of the following conditions is NOT one of the necessary conditions for deadlock? A. Mutual exclusion B. Bounded waiting C. No preemption D. Hold and wait ❓ Câu 17:
Deadlock prevention strategy may lead to: A. Low CPU utilization B. Reduced system throughput C. Increased resource wastage D. All of the above ❓ Câu 18:
Which of the following is TRUE for Banker’s Algorithm?
A. It can detect deadlock but not prevent it
B. It can prevent deadlock by avoiding unsafe states
C. It ignores the resource request order
D. It requires the average resource demand of each process ❓ Câu 19: lOMoAR cPSD| 58702377
A system is in a safe state when:
A. It is free from deadlock permanently
B. Resources can be allocated in some order to avoid deadlock C. All processes are running D. CPU utilization is 100% ❓ Câu 20:
Which of the following best defines a critical section?
A. A portion of code where I/O operations are performed
B. A portion of code that modifies shared data
C. A portion of code executed by the OS only
D. A portion of code for process creation ❓ Câu 21:
Which of the following is a solution to the critical section problem? A. Deadlock prevention B. Banker’s algorithm C. Peterson’s algorithm D. Round Robin algorithm ❓ Câu 22:
Which one of the following is NOT a feature of Semaphores? A. Wait and signal operations B. Integer variable C. Busy-waiting
D. Automatically scheduled threads ❓ Câu 23:
The wait operation in semaphores:
A. Increments the value of semaphore B. Checks the condition only
C. Decrements the value and may block D. Terminates the process ❓ Câu 24:
A semaphore used for mutual exclusion is called: A. Mutex semaphore B. Binary semaphore C. Counting semaphore D. Both A and B lOMoAR cPSD| 58702377 ❓ Câu 25:
Which is true about spinlock?
A. It is efficient when wait time is long
B. It uses sleep instead of CPU cycle C. It wastes CPU cycles
D. It is implemented using high-level languages only ❓ Câu 26:
In a Monitor, the shared variables are:
A. Declared inside the monitor and accessible only via procedures B. Global variables C. Protected by mutex locks D. Used only by the OS ❓ Câu 27:
Which of the following is NOT a system call? A. fork() B. exec() C. wait() D. printf() ❓ Câu 28:
The process that has completed execution but still has an entry in the process table is called: A. Orphan process B. Running process
C. Zombie processD. Daemon process ❓ Câu 29:
Which of the following is true for a race condition?
A. Two threads always execute sequentially
B. Output depends on the execution order of threads
C. Threads do not share dataD. Output is always consistent ❓ Câu 30:
A solution to the race condition problem must satisfy: A. Mutual exclusion only B. Progress only C. Bounded waiting only
D. All three: mutual exclusion, progress, and bounded waiting ❓ Câu 31: lOMoAR cPSD| 58702377
Which of the following is NOT a classical problem of synchronization? A. Reader-Writer problem B. Dining Philosopher problem C. Sleeping Barber problem D. Producer-Retailer problem ❓ Câu 32:
Which scheduling algorithm is used in a time-sharing system? A. Shortest job first B. First come first served
C. Round robinD. Priority scheduling ❓ Câu 33:
Which system call is used to terminate a process? A. exit() B. fork() C. wait() D. kill() ❓ Câu 34:
What is the primary purpose of the wait() system call? A. Create a new process
B. Stop current process execution permanently
C. Wait for child process to terminate D. Resume a suspended process ❓ Câu 35:
In UNIX, the system call used to create a new process is: A. exec() B. exit() C. fork() D. wait() ❓ Câu 36:
Which of the following best describes orphan process?
A. A child process whose parent terminated without waiting for it
B. A process that runs without creating any children
C. A terminated process still in the process table
D. A daemon process with high privilege ❓ Câu 37:
Which of the following is true about zombie processes? lOMoAR cPSD| 58702377
A. They are killed immediately by the kernel B. They are waiting for I/O
C. They have finished executing but still occupy entry in the process table
D. They consume CPU time continuously ❓ Câu 38:
In Round Robin scheduling, each process is assigned: A. A time slice or quantum B. A fixed priority level
C. The shortest burst timeD. Random time to execute ❓ Câu 39:
Which scheduling algorithm is non-preemptive? A. Round Robin B. Shortest Job First (SJF)
C. Shortest Remaining Time First (SRTF)
D. Preemptive Priority Scheduling ❓ Câu 40:
What is the disadvantage of FCFS (First Come First Served) scheduling? A. Starvation B. Low CPU utilization
C. Convoy effectD. Context switching overhead ❓ Câu 41:
In SJF scheduling, which process is executed first?
A. The one with shortest arrival time
B. The one with lowest priority
C. The one with the shortest CPU burst time D. The one with smallest PID ❓ Câu 42:
Which of the following is true about preemptive scheduling?
A. Process holds CPU until termination
B. CPU is allocated to the longest job
C. Running process can be interrupted
D. It always leads to starvation ❓ Câu 43: The context switch is:
A. Switching from kernel mode to user mode lOMoAR cPSD| 58702377
B. Saving and loading process state C. Switching I/O to CPU D. Calling the scheduler ❓ Câu 44:
Which of the following is NOT a process state? A. Running B. Waiting C. Terminated D. Swapping ❓ Câu 45:
In preemptive scheduling, when does the running process release the CPU? A. When it finishes B. When it performs I/O
C. After a time slice expires or higher priority arrives D. It never releases CPU ❓ Câu 46:
Which scheduling algorithm may suffer from starvation? A. FCFS B. Round Robin C. Priority Scheduling D. SJF ❓ Câu 47:
The term aging in scheduling refers to:
A. Gradually decreasing the priority of processes over time
B. Gradually increasing the priority of waiting processes to avoid starvation
C. Killing old processes to free memoryD. Suspending processes that run too long ❓ Câu 48:
Which of the following is an advantage of virtual machine OS?
A. It runs only one environment at a time
B. It supports only single-user mode
C. It allows multiple environments on the same hardware
D. It runs without CPU scheduling ❓ Câu 49:
As a control program, the operating system: A. Compiles user programs lOMoAR cPSD| 58702377
B. Controls the execution of user programs and I/O operations C. Manages databases
D. Handles application-layer protocols ❓ Câu 50: The operating system manages: A. Memory B. CPU
C. I/O devicesD. All of the above ❓ Câu 51:
In Shortest Remaining Time First (SRTF), what is the average waiting time for the following processes? Process Arrival Burst P1 0 12 P2 2 4 P3 3 6 P4 8 5 A. 6.25 B. 5.25 C. 7.5 D. 4.75 ❓ Câu 52:
In Round Robin (RR) scheduling with quantum = 2, what is the average waiting time for the following? Process Arrival Burst P1 0 9 P2 1 5 P3 2 3 P4 3 4 A. 10.5 B. 9.25 C. 7.75 D. 8.0 ❓ Câu 53:
Which of the following operating systems does not support long file names? A. MS-DOS B. OS/2 lOMoAR cPSD| 58702377 C. Windows NT D. Windows 95 ❓ Câu 54: The kernel is:
A. The part of OS that contains essential modules only B. A user-level program C. A compiler D. A GUI interface ❓ Câu 55: BIOS is: A. Part of OS kernel
B. Software that handles low-level I/O before OS loads
C. A bootloaderD. A device driver ❓ Câu 56:
Which of the following is not a function of an Operating System? A. Memory Management B. File Management
C. Compiler DesignD. I/O Device Management ❓ Câu 57:
Which of the following is the first program that is executed when the computer is powered on? A. Operating system B. Bootloader C. Bootstrap program D. BIOS setup ❓ Câu 58: In RR with q = 2: Process Arrival Burst P1 0 5 P2 1 7 P3 3 4 lOMoAR cPSD| 58702377
Which is the order of completion? A. P1, P2, P3 B. P2, P3, P1 C. P3, P1, P2 D. P1, P3, P2 ❓ Câu 59:
Which of the following is used to detect deadlock? A. Resource Allocation Graph B. Page Replacement Table C. Disk Scheduling Queue D. Stack Pointer ❓ Câu 60:
What is the name of the algorithm used in deadlock avoidance? A. Reader-writer algorithm
B. Shortest Job First algorithm C. Banker's algorithm D. FIFO queue ❓ Câu 1:
The term safe state is used in: A. Deadlock avoidance B. Memory segmentation C. Process synchronization D. File protection ❓ Câu 2:
The main purpose of a monitor is: lOMoAR cPSD| 58702377 A. Handle file systems B. Manage CPU registers
C. Provide synchronization without busy waiting D. Detect interrupts ❓ Câu 3: A binary semaphore:
A. Can take any positive integer value B. Can take only 0 or 1 C. Can take negative values
D. Cannot be used for mutual exclusion ❓ Câu 4:
Which of the following best defines a zombie process? A. A process with no child
B. A terminated process with entry still in process table
C. A daemon processD. A suspended process ❓ Câu 5:
Match the following pairs of data: • Round Robin → ? • Scan → ? • LIFO → ? A. Disk check B. Stack operation C. Time sharing D. Batch processing
✅ Gợi ý đáp án đúng: • Round Robin → Time sharing • LIFO → Stack operation Scan → Batch processing ❓ Câu 6:
Process | Arrival Time | Burst Time P1 | 0 | 10 P2 | 2 | 20 P3 | 6 | 30
Assuming there is no context switch at time 0, if using SRT (Shortest Remaining Time) CPU scheduling
algorithm, how many times context switch occurs? A. 4 B. 3 C. 2 D. 1 lOMoAR cPSD| 58702377 ❓ Câu 7:
Which runs on computer hardware and serves as a platform for other software to run on? A. All B. System software
C. Operating systemD. Application program ❓ Câu 8:
An OS is a software that provides a working environment for the applications of users. A. Đúng B. Sai ❓ Câu 9:
_______ is used in an operating system to separate mechanism from policy. A. Multi level implementation B. None
C. Two level implementationD. Single level implementation ❓ Câu 10:
The CPU transferring from one process/thread to another is called:
A. the rest of the options are correct B. context switch
C. task switchD. process switch ❓ Câu 11:
The CPU transferring from one process/thread to another is called:
A. the rest of the options are correct B. context switch
C. task switchD. process switch ❓ Câu 12:
System programs are utility programs, which help the user and may call for further system calls. A. Đúng B. Sai ❓ Câu 13:
Which file keeps commands to execute automatically when OS is started? A. config.sys B. any batch file C. command.com D. autoexec.bat lOMoAR cPSD| 58702377 ❓ Câu 14:
Multi-tasking systems place more than one job/program/task in main memory. The jobs are scheduled by: A. Priority queue B. Time-sharing technique
C. Semaphore logicD. Single user batch ❓ Câu 15:
In a time-sharing operating system, when the CPU time allocated to a process expires, what state will the process go from running to? A. Terminated B. Blocked C. Suspended D. Ready ❓ Câu 16:
Multi-programmed batch systems place more than one job/task in memory and switch between them to
execute. This technique improves: A. CPU idle time
B. Throughput and CPU utilization
C. Input buffering onlyD. Spooling performance ❓ Câu 17:
Which is the first program run on a computer when the computer boots up? A. System operations B. Operating system C. System program D. None ❓ Câu 18:
In Windows, the primary hard disk drive has the drive letter: A. A B. B C. C D. D ❓ Câu 19:
The operating system creates ______ from the physical computer. A. Virtual space B. Virtual device C. None D. Virtual computers lOMoAR cPSD| 58702377 ❓ Câu 20:
As a resource manager, the operating system controls user activities, I/O access, and all other system operations. A. Đúng B. Sai ❓ Câu 21:
The first program that is executed when the computer is switched on is called: A. boot program B. initializer C. bootstrap program D. bootloader ❓ Câu 22: Interrupt vector is:
A. A unique identity given to an interrupt
B. An address that is indexed to an interrupt handler C. None of the mentioned
D. A unique device number that is indexed by an address ❓ Câu 23:
The advantage of the virtual machine OS is:
A. Only one execution environment is supported per hardware
B. Hardware is shared to run different environments such as multiprogramming and time-sharing
C. Physical machines are no longer needed
D. OS bypasses the need for I/O handling ❓ Câu 24:
The term aging refers to:
A. Letting the process sit in memory for a long time to estimate needed pages
B. Gradually increasing the priority of long-waiting processes
C. Tracking LRU page replacement orderD. Initialization of a process in multilevel queue ❓ Câu 25: Exokernel works as:
A. A traditional monolithic kernel for system apps
B. An executive for application programs ensuring safe use of resources and allocation
C. Middleware between OS and hardware
D. Replacement of device drivers ❓ Câu 26: lOMoAR cPSD| 58702377
As a control program, the operating system schedules and manages the allocation of: A. Only memory B. Application resources only
C. All resources in the computer system D. Only CPU processes ❓ Câu 27: The operating system manages:
A. Disk and Input/Output devices B. Memory C. AllD. Processes ❓ Câu 28:
Consider a system with 4 processes with the following parameters:
Process Arrival Time Burst Time P1 0 12 P2 2 4 P3 3 6 P4 8 5
If using SRTF scheduling algorithm, the average waiting time is: A. 6.25 B. 5.25 C. 7.5 D. 4.75 ❓ Câu 29:
Consider a system with 4 processes with the following parameters:
Process Arrival Time Burst Time P1 0 9 P2 1 5 P3 2 3 P4 3 4
If using RR(q = 2) scheduling algorithm, the average waiting time is: A. 8.0 B. 10.5 C. 9.25 D. 7.75 ❓ Câu 30:
Which Operating System doesn’t support long file names? lOMoAR cPSD| 58702377 A. MS DOS B. OS/2 C. Windows 95D. Windows NT ❓ Câu 31:
Kernel is the part wherein only essential modules of the operating system are placed. A. Đúng B. Sai ❓ Câu 32:
BIOS is a software that consists of input-output functions. These are low-level routines that the OS uses to
interface with I/O devices like keyboard, screen, ports, etc. A. Đúng B. Sai ❓ Câu 33:
Process Arrival Time Burst Time P1 0 5 P2 1 7 P3 3 4
The order of completion of the 3 processes under the RR (q = 2) algorithm is: A. P1, P2, P3 B. P1, P3, P2 C. P2, P3, P1 D. P3, P1, P2