[{"data":1,"prerenderedAt":558},["ShallowReactive",2],{"note:cs\u002Fos\u002Fnote\u002Fchap2":3,"site-search-catalogue":557},{"id":4,"title":5,"body":6,"description":522,"extension":549,"meta":550,"navigation":552,"path":553,"seo":554,"stem":555,"__hash__":556},"notes\u002Fsource\u002Fcs\u002Fos\u002Fnote\u002Fchap2.md","Chap. 2 Note",{"type":7,"value":8,"toc":521},"minimark",[9,14,19,27,49,54,57,108,112,115,130,134,137,140,144,148,151,169,173,180,211,215,218,236,240,243,258,260,264,268,275,297,301,304,337,353,357,360,386,390,393,412,414,418,454,456,460,466,468,472,476,479,496,500,503],[10,11,13],"h1",{"id":12},"chapter-2-operating-system-overview","Chapter 2: Operating System Overview",[15,16,18],"h2",{"id":17},"_1-operating-system-objectives-and-functions","1. Operating System Objectives and Functions",[20,21,22,26],"p",{},[23,24,25],"strong",{},"Def",": An Operating System is a program that controls the execution of application programs and acts as an interface between applications and the computer hardware. It has three main objectives:",[28,29,30,37,43],"ul",{},[31,32,33,36],"li",{},[23,34,35],{},"Convenience (方便):"," Makes a computer more convenient to use for the end user,.",[31,38,39,42],{},[23,40,41],{},"Efficiency (高效):"," Allows the computer system resources to be used in an efficient manner,.",[31,44,45,48],{},[23,46,47],{},"Ability to evolve (可演进能力):"," Permits the effective development, testing, and introduction of new system functions without interfering with service,.",[50,51,53],"h3",{"id":52},"_11-the-os-as-a-usercomputer-interface","1.1 The OS as a User\u002FComputer Interface",[20,55,56],{},"The OS masks the details of the hardware from the programmer and provides a convenient interface. It typically provides services in the following areas:",[28,58,59,65,71,77,83,89,95,101],{},[31,60,61,64],{},[23,62,63],{},"Program development:"," Provides tools like editors and debuggers (often via utilities).",[31,66,67,70],{},[23,68,69],{},"Program execution:"," Handles scheduling duties, loads instructions\u002Fdata into main memory, and initializes files and I\u002FO devices.",[31,72,73,76],{},[23,74,75],{},"Access to I\u002FO devices:"," Hides specific hardware details and provides a uniform interface for reading and writing.",[31,78,79,82],{},[23,80,81],{},"Controlled access to files:"," Understands storage media and data structures, and provides protection mechanisms in multi-user environments.",[31,84,85,88],{},[23,86,87],{},"System access:"," Resolves resource conflicts and protects resources\u002Fdata from unauthorized access.",[31,90,91,94],{},[23,92,93],{},"Error detection and response:"," Responds to internal\u002Fexternal hardware errors or software errors with minimal impact on running applications-.",[31,96,97,100],{},[23,98,99],{},"Accounting (记账):"," Collects usage statistics to tune system performance and bill users.",[31,102,103,104,107],{},"It provides an ",[23,105,106],{},"Application Programming Interface (API, 应用程序编程接口)",", allowing software to be ported easily across systems-.",[50,109,111],{"id":110},"_12-the-os-as-resource-manager","1.2 The OS as Resource Manager",[20,113,114],{},"The OS is responsible for controlling the use of a computer's resources (I\u002FO, main\u002Fsecondary memory, processor execution time).",[28,116,117,120,123],{},[31,118,119],{},"Unlike typical control mechanisms, the OS functions as an ordinary computer program executed by the processor.",[31,121,122],{},"It frequently relinquishes control to let the processor perform \"useful\" work and depends on the processor to regain control.",[31,124,125,126,129],{},"The ",[23,127,128],{},"Kernel (内核)",", or nucleus, contains the most frequently used OS functions and typically remains permanently in main memory,-.",[50,131,133],{"id":132},"_13-ease-of-evolution","1.3 Ease of Evolution",[20,135,136],{},"An OS will evolve over time due to hardware upgrades, new types of hardware, new services, and software fixes-. This requires the OS to be modular in construction with clearly defined interfaces.",[138,139],"hr",{},[15,141,143],{"id":142},"_2-the-evolution-of-operating-systems","2. The Evolution of Operating Systems",[50,145,147],{"id":146},"_21-serial-processing-串行处理","2.1 Serial Processing (串行处理)",[20,149,150],{},"In early computers (late 1940s to mid-1950s), there was no OS; programmers interacted directly with hardware.",[28,152,153,159],{},[31,154,155,158],{},[23,156,157],{},"Scheduling:"," Users used a hardcopy sign-up sheet, which often resulted in wasted computer processing time-.",[31,160,161,164,165,168],{},[23,162,163],{},"Setup time:"," A single ",[23,166,167],{},"job (作业)"," involved mounting tapes and setting up card decks manually, causing a considerable waste of time.",[50,170,172],{"id":171},"_22-simple-batch-systems-简单批处理系统","2.2 Simple Batch Systems (简单批处理系统)",[20,174,175,176,179],{},"To maximize processor utilization, early batch OSs used a ",[23,177,178],{},"Monitor (监控程序)","-.",[28,181,182,185,188,194,200],{},[31,183,184],{},"Users submitted jobs on cards\u002Ftape to an operator, who batched them together on an input device for the monitor.",[31,186,187],{},"The monitor automatically loaded the next program after a job was completed, avoiding idle time-.",[31,189,190,193],{},[23,191,192],{},"Job Control Language (JCL, 作业控制语言)"," was used to provide instructions to the monitor.",[31,195,196,199],{},[23,197,198],{},"Hardware Features Required:"," Memory protection (内存保护), Timer (定时器), Privileged instructions (特权指令), and Interrupts (中断).",[31,201,202,203,206,207,210],{},"Execution modes were split into ",[23,204,205],{},"User mode (用户态)"," (with restricted memory and instruction access) and ",[23,208,209],{},"Kernel mode \u002F System mode (内核态\u002F系统态)"," (for the monitor to execute privileged instructions),.",[50,212,214],{"id":213},"_23-multiprogrammed-batch-systems-多道批处理系统","2.3 Multiprogrammed Batch Systems (多道批处理系统)",[20,216,217],{},"In a simple batch system, the processor is often idle waiting for slow I\u002FO devices.",[28,219,220,226,233],{},[31,221,222,225],{},[23,223,224],{},"Multiprogramming \u002F Multitasking (多道程序设计\u002F多任务处理):"," Expands memory to hold multiple programs; when one job waits for I\u002FO, the processor switches to another job,.",[31,227,228,229,232],{},"This relies on hardware supporting I\u002FO interrupts and ",[23,230,231],{},"Direct Memory Access (DMA, 直接内存访问)",".",[31,234,235],{},"It maximizes processor utilization but requires advanced memory management and scheduling algorithms,.",[50,237,239],{"id":238},"_24-time-sharing-systems-分时系统","2.4 Time-Sharing Systems (分时系统)",[20,241,242],{},"Used to handle multiple interactive jobs by interleaving execution in short bursts or time slices.",[28,244,245,248,255],{},[31,246,247],{},"Multiple users simultaneously access the system through terminals.",[31,249,250,251,254],{},"While multiprogramming maximizes processor use, time-sharing aims to minimize ",[23,252,253],{},"Response time (响应时间)",",.",[31,256,257],{},"Examples include the Compatible Time-Sharing System (CTSS).",[138,259],{},[15,261,263],{"id":262},"_3-major-achievements","3. Major Achievements",[50,265,267],{"id":266},"_31-the-process-进程","3.1 The Process (进程)",[20,269,270,271,274],{},"A ",[23,272,273],{},"Process (进程)"," is defined as a program in execution, an instance of a running program, or a unit of activity characterized by a single sequential thread of execution, a current state, and an associated set of system resources,.",[28,276,277,288,291],{},[31,278,279,280,283,284,287],{},"It consists of three components: an executable program, associated data, and the ",[23,281,282],{},"Execution context (执行上下文)"," (or ",[23,285,286],{},"Process state (进程状态)",")-,-.",[31,289,290],{},"The execution context includes contents of processor registers and information the OS needs to manage the process, allowing the OS to suspend and resume the process correctly,.",[31,292,293,296],{},[23,294,295],{},"Thread (线程):"," A single process can be broken up into multiple, concurrent threads that execute cooperatively.",[50,298,300],{"id":299},"_32-memory-management-内存管理","3.2 Memory Management (内存管理)",[20,302,303],{},"The OS has five principal storage management responsibilities-,:",[305,306,307,313,319,325,331],"ol",{},[31,308,309,312],{},[23,310,311],{},"Process isolation (进程隔离):"," Preventing independent processes from interfering with each other's memory,.",[31,314,315,318],{},[23,316,317],{},"Automatic allocation and management:"," Dynamically allocating memory across the hierarchy transparently to the programmer,.",[31,320,321,324],{},[23,322,323],{},"Support of modular programming:"," Allowing dynamic creation and alteration of program modules,.",[31,326,327,330],{},[23,328,329],{},"Protection and access control:"," Permitting shared memory while protecting the integrity of programs\u002FOS,.",[31,332,333,336],{},[23,334,335],{},"Long-term storage:"," Storing information persistently (e.g., via file systems),.",[28,338,339],{},[31,340,341,344,345,348,349,352],{},[23,342,343],{},"Virtual memory (虚拟内存):"," Allows programs to address memory logically without worrying about physical limitations. It maps a ",[23,346,347],{},"Virtual address (虚拟地址)"," to a ",[23,350,351],{},"Real address \u002F Physical address (实地址\u002F物理地址)"," dynamically-,.",[50,354,356],{"id":355},"_33-information-protection-and-security-信息保护与安全","3.3 Information Protection and Security (信息保护与安全)",[20,358,359],{},"Security policies generally target four categories:",[305,361,362,368,374,380],{},[31,363,364,367],{},[23,365,366],{},"Availability (可用性):"," Protecting against interruption.",[31,369,370,373],{},[23,371,372],{},"Confidentiality (机密性):"," Assuring unauthorized users cannot read data.",[31,375,376,379],{},[23,377,378],{},"Data integrity (数据完整性):"," Protecting data from unauthorized modification.",[31,381,382,385],{},[23,383,384],{},"Authenticity (真实性):"," Verifying user identity and message validity.",[50,387,389],{"id":388},"_34-scheduling-and-resource-management-调度和资源管理","3.4 Scheduling and Resource Management (调度和资源管理)",[20,391,392],{},"The OS must schedule process execution and allocate resources based on three factors-:",[28,394,395,401,407],{},[31,396,397,400],{},[23,398,399],{},"Fairness (公平性):"," Giving processes equal and fair access to resources.",[31,402,403,406],{},[23,404,405],{},"Differential responsiveness (差异响应性):"," Discriminating among different classes of jobs to meet different service requirements dynamically.",[31,408,409,411],{},[23,410,41],{}," Maximizing throughput, minimizing response time, and accommodating the maximum number of users.",[138,413],{},[15,415,417],{"id":416},"_4-developments-leading-to-modern-operating-systems","4. Developments Leading to Modern Operating Systems",[28,419,420,430,436,442,448],{},[31,421,422,425,426,429],{},[23,423,424],{},"Microkernel architecture (微内核架构):"," Assigns only a few essential functions (e.g., address space management, Interprocess Communication (IPC), basic scheduling) to the kernel,. Other services run in user mode, unlike a ",[23,427,428],{},"Monolithic kernel (单体内核)"," where all elements share the same address space,.",[31,431,432,435],{},[23,433,434],{},"Multithreading (多线程):"," A technique where a process is divided into threads that run concurrently,. A thread is a dispatchable unit of work; a process is a collection of threads and associated resources.",[31,437,438,441],{},[23,439,440],{},"Symmetric Multiprocessing (SMP, 对称多处理):"," The OS schedules threads across multiple processors, offering advantages in Performance, Availability, Incremental growth, and Scaling-.",[31,443,444,447],{},[23,445,446],{},"Distributed Operating Systems (分布式操作系统):"," Provides the illusion of a single main and secondary memory space across a cluster of separate computers.",[31,449,450,453],{},[23,451,452],{},"Object-oriented design (面向对象设计):"," Allows programmers to customize the OS without disrupting system integrity.",[138,455],{},[15,457,459],{"id":458},"_5-fault-tolerance-容错","5. Fault Tolerance (容错)",[20,461,462,465],{},[23,463,464],{},"Fault tolerance (容错)"," is the ability of a system to continue normal operations despite the presence of hardware or software faults. This involves redundancy to increase reliability, balancing the costs against the critical nature of the resources.",[138,467],{},[15,469,471],{"id":470},"_6-os-design-considerations-for-multiprocessor-and-multicore","6. OS Design Considerations for Multiprocessor and Multicore",[50,473,475],{"id":474},"_61-smp-os-considerations","6.1 SMP OS Considerations",[20,477,478],{},"An SMP OS must manage processor and computer resources to provide the illusion of a uniprocessor system. Key design issues include-,:",[28,480,481,484,487,490,493],{},[31,482,483],{},"Simultaneous concurrent processes or threads,.",[31,485,486],{},"Scheduling,.",[31,488,489],{},"Synchronization,.",[31,491,492],{},"Memory management,.",[31,494,495],{},"Reliability and fault tolerance,.",[50,497,499],{"id":498},"_62-multicore-os-considerations","6.2 Multicore OS Considerations",[20,501,502],{},"With \"many-core\" systems, the challenge is extracting parallelism from workloads-.",[28,504,505,511,518],{},[31,506,507,510],{},[23,508,509],{},"Parallelism within Applications:"," Developers divide applications into parallel tasks.",[31,512,513,514,517],{},"OS approaches like Apple's ",[23,515,516],{},"Grand Central Dispatch (GCD)"," map tasks onto a pool of available threads.",[31,519,520],{},"Future architectures might drop the distinction between user and kernel mode, treating the OS more like a hypervisor while applications self-manage resources-.",{"title":522,"searchDepth":523,"depth":523,"links":524},"",2,[525,531,537,543,544,545],{"id":17,"depth":523,"text":18,"children":526},[527,529,530],{"id":52,"depth":528,"text":53},3,{"id":110,"depth":528,"text":111},{"id":132,"depth":528,"text":133},{"id":142,"depth":523,"text":143,"children":532},[533,534,535,536],{"id":146,"depth":528,"text":147},{"id":171,"depth":528,"text":172},{"id":213,"depth":528,"text":214},{"id":238,"depth":528,"text":239},{"id":262,"depth":523,"text":263,"children":538},[539,540,541,542],{"id":266,"depth":528,"text":267},{"id":299,"depth":528,"text":300},{"id":355,"depth":528,"text":356},{"id":388,"depth":528,"text":389},{"id":416,"depth":523,"text":417},{"id":458,"depth":523,"text":459},{"id":470,"depth":523,"text":471,"children":546},[547,548],{"id":474,"depth":528,"text":475},{"id":498,"depth":528,"text":499},"md",{"order":551},1,true,"\u002Fsource\u002Fcs\u002Fos\u002Fnote\u002Fchap2",{"title":5,"description":522},"source\u002Fcs\u002Fos\u002Fnote\u002Fchap2","mMs1rIXfNOsq5oLjymjP19jWu_QGHYyT9YZlr7fM8kI",null,1784032891836]