随笔分类 - Computer System
摘要:1 a thread-unsafe code version: 1.1 correct version 1: 1.2 correct version 2 and its pros and cons: Another approach is to pass the integer i directly
阅读全文
摘要:Using Threads for Parallelism Figure 12.30 shows the set relationships between sequential, concurrent, and parallel programs. A parallel program is a
阅读全文
摘要:Using Semaphores to Schedule Shared Resources In this scenario, a thread uses a semaphore operation to notify another thread that some condition in th
阅读全文
摘要:Shared Variables in Threaded Programs Threads Memory Model Thus, registers are never shared, whereas virtual memory is always shared. The memory model
阅读全文
摘要:Modern operating systems provide three basic approaches for building concurrent programs: Processes. With this approach, each logical control flow is
阅读全文
摘要:It is important to realize that clients and servers are processes and not ma- chines, or hosts as they are often called in this context. Data received
阅读全文
摘要:An input operation copies data from an I/O device to main memory, and an output operation copies data from memory to a device. All language run-time s
阅读全文
摘要:Working within these constraints, the author of an allocator attempts to meet the often conflicting performance goals of maximizing throughput and mem
阅读全文
摘要:The execve Function Revisited Suppose that the program running in the current process makes the following call: Execve("a.out", NULL, NULL); Loading a
阅读全文
摘要:Linux organizes the virtual memory as a collection of areas (also called segments). An area is a contiguous chunk of existing (allocated) virtual memo
阅读全文
摘要:Integrating Caches and VM TODO peeding up Address Translation with a TLB Many systems try to eliminate even this cost by including a small cache of PT
阅读全文
摘要:Page Hits: CPU reads a word of virtual memory which is cached in DRAM. Page Faults(缺页): 流程: 术语: Virtual memory systems use a different terminology fro
阅读全文
摘要:Synchronizing Flows to Avoid Nasty Concurrency Bugs an example code: void handler(int sig) { pid_t pid; while ((pid = waitpid(-1, NULL, 0)) > 0) /* Re
阅读全文
摘要:example codes: if (errno != ECHILD) unix_error("waitpid error");//Version 4 code in purple, same with version 2 if (errno != ECHILD) unix_error("waitp
阅读全文
摘要:A signal that has been sent but not yet received is called a pending signal. At any point in time, there can be at most one pending signal of a partic
阅读全文
摘要:Putting Processes to Sleep The sleep function suspends a process for a specified period of time. Sleep returns zero if the requested amount of time ha
阅读全文
摘要:Process Control Obtaining Process IDs Each process has a unique positive (nonzero) process ID (PID). The getpid function returns the PID of the callin
阅读全文
摘要:Processes The classic definition of a process is an instance of a program in execution. Each program in the system runs in the context of some process
阅读全文
摘要:Faults Faults result from error conditions that a handler might be able to correct. When a fault occurs, the processor transfers control to the fault
阅读全文
摘要:different levels of ECF: In general, we refer to these abrupt changes as exceptional control flow (ECF). Exceptional control flow occurs at all levels
阅读全文