Hardware Reference
In-Depth Information
The third synchronization mechanism is based on critical sections , which are
similar to mutexes, except local to the address space of the creating thread. Be-
cause critical sections are not kernel objects, they do not have handles or security
descriptors and cannot be passed between processes. Locking and unlocking is
done with EnterCriticalSection and LeaveCriticalSection , respectively. Because
these API functions are performed entirely in user space, they are much faster than
mutexes. Windows 7 also provides condition variables, lightweight reader/writer
locks, lock-free operations, and other synchronization mechanisms that work only
between the threads of a single process.
The last synchronization mechanism uses kernel objects called events .A
thread can wait for an event to occur with WaitForSingleObject . A thread can re-
lease a single thread waiting on an event with SetEvent or it can release all threads
waiting on an event with PulseEvent . Events come in several flavors and have a
variety of options, too. Windows uses events to synchronize on the completion of
asynchronous I/O and for other purposes.
Events, mutexes, and semaphores can all be named and stored in the file sys-
tem, like named pipes. Two or more processes can synchronize by opening the
same event, mutex, or semaphore, rather than having one of them create the object
and then make duplicate handles for the others, although the latter approach is cer-
tainly an option as well.
6.6 SUMMARY
The operating system can be regarded as an interpreter for certain architectural
features not found at the ISA level. Chief among these are virtual memory, virtual
I/O instructions, and facilities for parallel processing.
Virtual memory is an architectural feature whose purpose is to allow programs
to use more address space than the machine has physical memory, or to provide a
consistent and flexible mechanism for memory protection and sharing. It can be
implemented as pure paging, pure segmentation, or a combination of the two. In
pure paging, the address space is broken up into equal-sized virtual pages. Some
of these are mapped onto physical page frames. Others are not mapped. A refer-
ence to a mapped page is translated by the MMU into the correct physical address.
A reference to an unmapped page causes a page fault. Both the Core i7 and the
OMAP4430 ARM CPU have MMUs that support virtual memory and paging.
The most important I/O abstraction present at this level is the file. A file con-
sists of a sequence of bytes or logical records that can be read and written without
knowledge of how disks, tapes, and other I/O devices work. Files can be accessed
sequentially, randomly by record number, or randomly by key. Directories can be
used to group files together. Files can be stored in consecutive sectors or scattered
around the disk. In the latter case, normal on hard disks, data structures are needed
 
 
Search WWH ::




Custom Search