text
stringlengths
1
7.76k
source
stringlengths
17
81
784 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 10.6.3 Implementation of the Linux File System In this section we will first look at the abstractions supported by the Virtual File System layer. The VFS hides from higher-level processes and applications the differences among many types of file systems supported by L...
clipped_os_Page_784_Chunk7001
SEC. 10.6 THE LINUX FILE SYSTEM 785 are cached in what is called the dentry cache. For instance, the dentry cache would contain entries for /, /usr, /usr/ast, and the like. If multiple processes access the same file through the same hard link (i.e., same path), their file object will point to the same entry in this cac...
clipped_os_Page_785_Chunk7002
786 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Tw o bitmaps are used to keep track of the free blocks and free i-nodes, respect- iv ely, a choice inherited from the MINIX 1 file system (and in contrast to most UNIX file systems, which use a free list). Each map is one block long. With a 1-KB block, this design lim...
clipped_os_Page_786_Chunk7003
SEC. 10.6 THE LINUX FILE SYSTEM 787 19 (a) 42 F 8 F 10 88 D 6 bigdir colossal voluminous Unused 19 (b) F 8 88 D 6 bigdir colossal Unused Unused I-node number Entry size Type File name length Figure 10-32. (a) A Linux directory with three files. (b) The same directory af- ter the file voluminous has been removed. name i...
clipped_os_Page_787_Chunk7004
788 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 number for the /usr/ast directory can be taken from it. Armed with the i-node num- ber of the /usr/ast directory, this i-node can be read and the directory blocks locat- ed. Finally, ‘‘file’’ is looked up and its i-node number found. Thus, the use of a rel- ative path...
clipped_os_Page_788_Chunk7005
SEC. 10.6 THE LINUX FILE SYSTEM 789 The problem is as follows. Associated with every file descriptor is a file position that tells at which byte the next read (or write) will start. Where should it go? One possibility is to put it in the i-node table. However, this approach fails if two or more unrelated processes happ...
clipped_os_Page_789_Chunk7006
790 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Mode i-node Link count Uid Gid File size Times Addresses of first 12 disk blocks Single indirect Double indirect Triple indirect Parent's file- descriptor table Child's file- descriptor table Unrelated process file- descriptor table Open file description File position...
clipped_os_Page_790_Chunk7007
SEC. 10.6 THE LINUX FILE SYSTEM 791 ext3, it changes the block addressing scheme used by its predecessors, thereby sup- porting both larger files and larger overall file-system sizes. We will describe some of its features next. The basic idea behind a journaling file system is to maintain a journal, which describes all...
clipped_os_Page_791_Chunk7008
792 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 scheme also reduces fragmentation for large files. As a result, ext4 can provide faster file system operations and support larger files and file system sizes. For instance, for a block size of 1 KB, ext4 increases the maximum file size from 16 GB to 16 TB, and the max...
clipped_os_Page_792_Chunk7009
SEC. 10.6 THE LINUX FILE SYSTEM 793 wide area network if the server is far from the client. For simplicity we will speak of clients and servers as though they were on distinct machines, but in fact, NFS al- lows every machine to be both a client and a server at the same time. Each NFS server exports one or more of its ...
clipped_os_Page_793_Chunk7010
794 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 NFS Protocols Since one of the goals of NFS is to support a heterogeneous system, with cli- ents and servers possibly running different operating systems on different hard- ware, it is essential that the interface between the clients and servers be well de- fined. Onl...
clipped_os_Page_794_Chunk7011
SEC. 10.6 THE LINUX FILE SYSTEM 795 also access file attributes, such as file mode, size, and time of last modification. Most Linux system calls are supported by NFS, with the perhaps surprising ex- ceptions of open and close. The omission of open and close is not an accident. It is fully intentional. It is not necessa...
clipped_os_Page_795_Chunk7012
796 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Client kernel Server kernel System call layer Buffer cache Buffer cache Virtual file system layer Virtual file system layer Local FS 1 Local FS 1 Local FS 2 Local FS 2 NFS client NFS server Driver Driver Driver Driver Message to server Message from client Local disks ...
clipped_os_Page_796_Chunk7013
SEC. 10.6 THE LINUX FILE SYSTEM 797 When a remote file is opened on the client, at some point during the parsing of the path name, the kernel hits the directory on which the remote file system is mounted. It sees that this directory is remote and in the directory’s v-node finds the pointer to the r-node. It then asks t...
clipped_os_Page_797_Chunk7014
798 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 one of them modifies it. When the other one reads the block, it gets the old (stale) value. The cache is not coherent. Given the potential severity of this problem, the NFS implementation does sev- eral things to mitigate it. For one, associated with each cache block ...
clipped_os_Page_798_Chunk7015
SEC. 10.7 SECURITY IN LINUX 799 UID of their owner. By default, the owner of a file is the person who created the file, although there is a way to change ownership. Users can be organized into groups, which are also numbered with 16-bit inte- gers called GIDs (Group IDs). Assigning users to groups is done manually (by ...
clipped_os_Page_799_Chunk7016
800 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 The user with UID 0 is special and is called the superuser (or root). The superuser has the power to read and write all files in the system, no matter who owns them and no matter how they are protected. Processes with UID 0 also have the ability to make a small number...
clipped_os_Page_800_Chunk7017
SEC. 10.7 SECURITY IN LINUX 801 10.7.2 Security System Calls in Linux There are only a small number of system calls relating to security. The most important ones are listed in Fig. 10-38. The most heavily used security system call is chmod. It is used to change the protection mode. For example, s = chmod("/usr/ast/newg...
clipped_os_Page_801_Chunk7018
802 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 from being stored in unencrypted form anywhere in the system. If the password is correct, the login program looks in /etc/passwd to see the name of the user’s pre- ferred shell, possibly bash, but possibly some other shell such as csh or ksh. The login program then us...
clipped_os_Page_802_Chunk7019
SEC. 10.8 ANDROID 803 level libraries are written in C and C++. However a large amount of the system is written in Java and, but for some small exceptions, the entire application API is written and published in Java as well. The parts of Android written in Java tend to follow a very object-oriented design as encouraged...
clipped_os_Page_803_Chunk7020
804 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 10.8.2 History of Android Google developed Android in the mid-2000s, after acquiring Android as a startup company early in its development. Nearly all the development of the Android platform that exists today was done under Google’s management. Early Development Andro...
clipped_os_Page_804_Chunk7021
SEC. 10.8 ANDROID 805 applications as a single process on a host computer. In fact there are still some remnants of this old implementation around today, with things like the Applica- tion.onTer minate method still in the SDK (Software Dev elopment Kit), which Android programmers use to write applications. In June 2006...
clipped_os_Page_805_Chunk7022
806 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Android also contained quite a few novel design ideas that had never been done before, and it was not clear how they would pan out. This all needed to come together as a stable product, and the team spent a few nail-biting months wonder- ing if all of this stuff would...
clipped_os_Page_806_Chunk7023
SEC. 10.8 ANDROID 807 Google code. However, the implementation of Google’s proprietary code was often not yet cleaned up, having dependencies on internal parts of the platform. Often the platform did not even hav e facilities that Google’s proprietary code need- ed in order to integrate well with it. A series of projec...
clipped_os_Page_807_Chunk7024
808 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 designed to be neutral as much as possible to the higher-level system features built on top of it, from access to cloud services (such as data sync or cloud-to-device messaging APIs), to libraries (such as Google’s mapping library) and rich services like application s...
clipped_os_Page_808_Chunk7025
SEC. 10.8 ANDROID 809 10.8.4 Android Architecture Android is built on top of the standard Linux kernel, with only a few signifi- cant extensions to the kernel itself that will be discussed later. Once in user space, however, its implementation is quite different from a traditional Linux distribution and uses many of th...
clipped_os_Page_809_Chunk7026
810 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 is called system server, which contains all of the core operating system services. Ke y parts of this are the power manager, package manager, window manager, and activity manager. Other processes will be created from zygote as needed. Some of these are ‘‘persistent’’ ...
clipped_os_Page_810_Chunk7027
SEC. 10.8 ANDROID 811 Application process System server Application Code PackageManager PackageManagerService Service manager "package" Binder IPC Binder IPC Binder IPC Figure 10-40. Publishing and interacting with system services. executing without an external interrupt such as pressing a power key. While run- ning, s...
clipped_os_Page_811_Chunk7028
812 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 their new dog and turn on the device to take a picture of her. In this kind of typical mobile usage, any delay from pulling the device out until it is ready for use has a significant negative impact on the user experience. Given these requirements, one solution would ...
clipped_os_Page_812_Chunk7029
SEC. 10.8 ANDROID 813 opportunity there to acquire its own wake lock. This flow may continue across subsystems in user space as well; as long as something is holding a wake lock, we continue performing the desired processing to respond to the event. Once no more wake locks are held, however, the entire system falls bac...
clipped_os_Page_813_Chunk7030
814 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Instead of trying to guess which processes should be killed, the Android out-of-memory killer relies very strictly on information provided to it by user space. The traditional Linux out-of-memory killer has a per-process oom adj pa- rameter that can be used to guide i...
clipped_os_Page_814_Chunk7031
SEC. 10.8 ANDROID 815 The use of Linux processes and security greatly simplifies the Dalvik environ- ment, since it is no longer responsible for these critical aspects of system stability and robustness. Not incidentally, it also allows applications to freely use native code in their implementation, which is especially...
clipped_os_Page_815_Chunk7032
816 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Preloaded resources Preloaded classes Dalvik Copy-on-write Dalvik Preloaded classes Preloaded resources Application classes and resources App process Zygote Figure 10-41. Creating a new Dalvik process from zygote. right. Android’s Binder interprocess communication mec...
clipped_os_Page_816_Chunk7033
SEC. 10.8 ANDROID 817 Platform / Application Interface definitions Method calls Ilnterface / aidl transact() onTransact() IBinder / Binder Binder user space Result codes command Codes ioctl() Binder kernel module Figure 10-42. Binder IPC architecture. is executed in the receiving process; the sender may block while the...
clipped_os_Page_817_Chunk7034
818 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 the sender. It determines which process is responsible for the target of the transac- tion and wakes up a thread in the process to receive it. Once the receiving process is executing, it determines the appropriate target of the transaction and delivers it. Process 1 P...
clipped_os_Page_818_Chunk7035
SEC. 10.8 ANDROID 819 Process 2—this is known by the kernel to be associated with Process 2, and further the kernel has assigned Handle 2 for it in Process 1. Process 1 can thus submit a transaction to the kernel targeted to its Handle 2, and from that the kernel can de- termine this is being sent to Process 2 and spec...
clipped_os_Page_819_Chunk7036
820 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Process 1 Process 1 Process 2 Object1b Object2a Object2a Object1b Handle 2 Handle 2 Handle 1 Handle 2 Handle 3 Handle 3 Handle 1 1 3 4 6 5 6 8 Transaction Transaction Transaction Transaction To: Handle 2 To: Handle 2 To: Object2a From: Process 1 From: Process 1 To: Ob...
clipped_os_Page_820_Chunk7037
SEC. 10.8 ANDROID 821 Binder User-Space API Most user-space code does not directly interact with the Binder kernel module. Instead, there is a user-space object-oriented library that provides a simpler API. The first level of these user-space APIs maps fairly directly to the kernel concepts we have covered so far, in t...
clipped_os_Page_821_Chunk7038
822 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Process 1 Binder1b Binder1b Binder1b Parcel transact() BinderProxy (Handle 2) BinderProxy (Handle 3) onTransact() Parcel Binder1b Binder2b Binder2a Process 1 Process 2 Process 2 Handle 1 Handle 1 Handle 2 Handle 3 Handle 3 Handle 3 Handle 2 Transaction Transaction To:...
clipped_os_Page_822_Chunk7039
SEC. 10.8 ANDROID 823 An interface description like that in Fig. 10-47 is compiled by AIDL to gener- ate three Java-language classes illustrated in Fig. 10-48: 1. IExample supplies the Java-language interface definition. 2. IExample.Stub is the base class for implementations of this inter- face. It inherits from Binder...
clipped_os_Page_823_Chunk7040
824 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 4. The transaction is decoded back into a Parcel and onTransact called on the appropriate local object, here ExampleImpl (which is a sub- class of IExample.Stub). 5. IExample.Stub decodes the Parcel into the appropriate method and arguments to call, here calling print...
clipped_os_Page_824_Chunk7041
SEC. 10.8 ANDROID 825 package android.os interface IServiceManager { IBinder getService(Str ing name); void addService(Str ing name, IBinder binder); } Figure 10-50. Basic service manager AIDL interface. An Android application by convention is a file with the apk extension, for Android Package. This file is actually a ...
clipped_os_Page_825_Chunk7042
826 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.email"> <application> <activity android:name="com.example.email.MailMainActivity"> <intent-filter> <action android:name="android.intent.act...
clipped_os_Page_826_Chunk7043
SEC. 10.8 ANDROID 827 Applications statically declare their entry points in their manifest so they do not need to execute code at install time that registers them with the system. This design makes the system more robust in many ways: installing an application does not require running any application code, the top-leve...
clipped_os_Page_827_Chunk7044
828 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 with the appropriate ActivityRecord. This activity is in a state called resumed since it is now in the foreground of the user interface. Activity manager in system_server process Email app process MailMainActivity Task: Email ActivityRecord (MailMainActivity) RESUMED ...
clipped_os_Page_828_Chunk7045
SEC. 10.8 ANDROID 829 manager and stores in the system server process, in the ActivityRecord associated with that activity. The saved state for an activity is generally small, containing for example where you are scrolled in an email message, but not the message itself, which will be stored elsewhere by the application...
clipped_os_Page_829_Chunk7046
830 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 be started and given the picture to be shared. (Later we will see how the camera application is able to find the email application’s ComposeActivity.) Performing that share option while in the activity state seen in Fig. 10-54 will lead to the new state in Fig. 10-55....
clipped_os_Page_830_Chunk7047
SEC. 10.8 ANDROID 831 application. Figure 10-56 shows the new state the system will be in. Note that we have brought the email task with its main activity back to the foreground. This makes MailMainActivity the foreground activity, but there is currently no instance of it running in the application’s process. Activity ...
clipped_os_Page_831_Chunk7048
832 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 2. It can serve as a connection point for other applications or the system to perform rich interaction with the application. This can be used by applications to provide secure APIs for other applications, such as to perform image or audio processing, provide a text to...
clipped_os_Page_832_Chunk7049
SEC. 10.8 ANDROID 833 1. The client application tells the activity manager that it would like to bind to the service. 2. If the service is not already created, the activity manager creates it in the service application’s process. 3. The service returns the IBinder for its interface back to the activity manager, which n...
clipped_os_Page_833_Chunk7050
834 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 for a list of all receivers interested in the event, which is placed in a Broadcast- Record representing that broadcast. The activity manager will then proceed to step through each entry in the list, having each associated application’s process create and execute the ...
clipped_os_Page_834_Chunk7051
SEC. 10.8 ANDROID 835 content://com.example.email.provider.email/messages means the list of all email messages, while content://com.example.email.provider.email/messages/1 provides access to a single message at key number 1. To interact with a content provider, applications always go through a system API called Content...
clipped_os_Page_835_Chunk7052
836 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Activity manager in system_server process Email app process ProviderRecord (EmailProvider) EmailProvider ContentResolver 1. query() Client app process 3. Create IBinder IContentProvider.Stub IContentProvider.Proxy 4. Return 5. Return 2. Look up Authority IBinder IBind...
clipped_os_Page_836_Chunk7053
SEC. 10.8 ANDROID 837 most important part of such an intent is a pair of strings naming the component: the package name of the target application and class name of the component within that application. Now referring back to the activity of Fig. 10-52 in application Fig. 10-51, an explicit intent for this component wou...
clipped_os_Page_837_Chunk7054
838 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 10.8.10 Application Sandboxes Traditionally in operating systems, applications are seen as code executing as the user, on the user’s behalf. This behavior has been inherited from the command line, where you run the ls command and expect that to run as your identity (U...
clipped_os_Page_838_Chunk7055
SEC. 10.8 ANDROID 839 caller. Binder IPC explicitly includes this information in every transaction deliv- ered across processes so a recipient of the IPC can easily ask for the UID of the caller. Android predefines a number of standard UIDs for the lower-level parts of the system, but most applications are dynamically ...
clipped_os_Page_839_Chunk7056
840 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 access that data, which is what we want since the pictures there may be sensitive data to the user. After the user has taken a picture, she may want to email it to a friend. Email is a separate application, in its own sandbox, with no access to the pictures in the cam...
clipped_os_Page_840_Chunk7057
SEC. 10.8 ANDROID 841 on processes and UIDs, so a security barrier always happens at a process boundary, and permissions themselves are associated with UIDs. Given this, a permission check can be performed by retrieving the UID associated with the incoming IPC and asking the package manager whether that UID has been gr...
clipped_os_Page_841_Chunk7058
842 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 receives a URI of the data to share, but does not know where it came from—in the figure here it comes from the camera, but any other application could use this to let the user email its data, from audio files to word-processing documents. The email application only ne...
clipped_os_Page_842_Chunk7059
SEC. 10.8 ANDROID 843 Activity manager in system_server process Camera app process Granted URIs Task: Pictures SEND content://pics/1 Saved state STOPPED RESUMED ActivityRecord (ComposeActivity) ActivityRecord (CameraActivity) To: ComposeActivity URI: content://pics/1 Allow Check PicturesProvider Authority: "pics" Compo...
clipped_os_Page_843_Chunk7060
844 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Activity manager in system_server process Camera app process PicturesProvider Authority: "pics" ComposeActivity Email app process Granted URls Allow Check Open content://pics/1 Receive data To: ComposeActivity URI: content://pics/1 Task: Pictures ActivityRecord (Pictu...
clipped_os_Page_844_Chunk7061
SEC. 10.8 ANDROID 845 Starting Processes In order to launch new processes, the activity manager must communicate with the zygote. When the activity manager first starts, it creates a dedicated socket with zygote, through which it sends a command when it needs to start a process. The command primarily describes the sand...
clipped_os_Page_845_Chunk7062
846 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 8. Activity manager sends to the new process any pending operations, in this case ‘‘start activity X.’’ 9. New process receives the command to start an activity, instantiates the appropriate Java class, and executes it. System_server process Application process Activi...
clipped_os_Page_846_Chunk7063
SEC. 10.8 ANDROID 847 based on the state of that process, by classifying them into major categories of use. Figure 10-68 shows the main categories, with the most important category first. The last column shows a typical oom adj value that is assigned to processes of this type. Categor y Description oom adj SYSTEM The s...
clipped_os_Page_847_Chunk7064
848 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 implemented by a content provider in the camera application. Other applications may want to access that picture data, becoming a client of the camera application. Dependencies between processes can happen with both content providers (through simple access to the provi...
clipped_os_Page_848_Chunk7065
SEC. 10.9 SUMMARY 849 Process State Impor tance system Core par t of operating system SYSTEM phone Always running for telephony stack PERSISTENT email Current foreground application FOREGROUND camera In use by email to load attachment FOREGROUND music Running background service playing music PERCEPTIBLE media In use by...
clipped_os_Page_849_Chunk7066
850 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 Process management in Linux is different compared to other UNIX systems in that Linux views each execution entity—a single-threaded process, or each thread with- in a multithreaded process or the kernel—as a distinguishable task. A process, or a single task in general...
clipped_os_Page_850_Chunk7067
SEC. 10.9 SUMMARY 851 PROBLEMS 1. Explain how writing UNIX in C made it easier to port it to new machines. 2. The POSIX interface defines a set of library procedures. Explain why POSIX stan- dardizes library procedures instead of the system-call interface. 3. Linux depends on gcc compiler to be ported to new architectu...
clipped_os_Page_851_Chunk7068
852 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 12. Why are negative arguments to nice reserved exclusively for the superuser? 13. A non-real-time Linux process has priority levels from 100 to 139. What is the default static priority and how is the nice value used to change this? 14. Does it make sense to take away...
clipped_os_Page_852_Chunk7069
CHAP. 10 PROBLEMS 853 28. In Linux, the data and stack segments are paged and swapped to a scratch copy kept on a special paging disk or partition, but the text segment uses the executable binary file instead. Why? 29. Describe a way to use mmap and signals to construct an interprocess-communication mechanism. 30. A fi...
clipped_os_Page_853_Chunk7070
854 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 41. In Fig. 10-24, both Fred and Lisa have access to the file x in their respective directories after linking. Is this access completely symmetrical in the sense that anything one of them can do with it the other one can, too? 42. As we have seen, absolute path names ...
clipped_os_Page_854_Chunk7071
CHAP. 10 PROBLEMS 855 running the program special rights only with respect to access to files. Why is this fea- ture useful? 56. On a Linux system, go to /proc/#### directory, where #### is a decimal number cor- responding to a process currently running in the system. Answer the following along with an explanation: (a)...
clipped_os_Page_855_Chunk7072
856 CASE STUDY 1: UNIX, LINUX, AND ANDROID CHAP. 10 mythreads exit, mythreads yield, mythreads self, and perhaps a few others. Next, im- plement these synchronization variables to enable safe concurrent operations: mythreads mutex init, mythreads mutex lock, mythreads mutex unlock. Before start- ing, clearly define the...
clipped_os_Page_856_Chunk7073
11 CASE STUDY 2: WINDOWS 8 Windows is a modern operating system that runs on consumer PCs, laptops, tablets and phones as well as business desktop PCs and enterprise servers. Win- dows is also the operating system used in Microsoft’s Xbox gaming system and Azure cloud computing infrastructure. The most recent version i...
clipped_os_Page_857_Chunk7074
858 CASE STUDY 2: WINDOWS 8 CHAP. 11 Year MS−DOS Notes MS-DOS based Windows NT-based Windows Modern Windows 1981 1.0 Initial release for IBM PC 1983 2.0 Suppor t for PC/XT 1984 3.0 Suppor t for PC/AT 1990 3.0 Ten million copies in 2 years 1991 5.0 Added memory management 1992 3.1 Ran only on 286 and later 1993 NT 3.1 1...
clipped_os_Page_858_Chunk7075
SEC. 11.1 HISTORY OF WINDOWS THROUGH WINDOWS 8.1 859 MS-DOS was a 16-bit real-mode, single-user, command-line-oriented operat- ing system consisting of 8 KB of memory resident code. Over the next decade, both the PC and MS-DOS continued to evolve, adding more features and capabili- ties. By 1986, when IBM built the PC/...
clipped_os_Page_859_Chunk7076
860 CASE STUDY 2: WINDOWS 8 CHAP. 11 Cutler’s system was called NT for New Technology (and also because the orig- inal target processor was the new Intel 860, code-named the N10). NT was de- signed to be portable across different processors and emphasized security and reliability, as well as compatibility with the MS-D...
clipped_os_Page_860_Chunk7077
SEC. 11.1 HISTORY OF WINDOWS THROUGH WINDOWS 8.1 861 NT did meet its portability goals, with additional releases in 1994 and 1995 adding support for (little-endian) MIPS and PowerPC architectures. The first major upgrade to NT came with Windows NT 4.0 in 1996. This system had the power, security, and reliability of NT,...
clipped_os_Page_861_Chunk7078
862 CASE STUDY 2: WINDOWS 8 CHAP. 11 Microsoft followed up Windows XP by embarking on an ambitious release to kindle renewed excitement among PC consumers. The result, Windows Vista, was completed in late 2006, more than fiv e years after Windows XP shipped. Win- dows Vista boasted yet another redesign of the graphical...
clipped_os_Page_862_Chunk7079
SEC. 11.1 HISTORY OF WINDOWS THROUGH WINDOWS 8.1 863 the same time, processor performance ceased to improve at the same rate it had previously, due to the difficulties in dissipating the heat created by ever-increasing clock speeds. Moore’s Law continued to hold, but the additional transistors were going into new featu...
clipped_os_Page_863_Chunk7080
864 CASE STUDY 2: WINDOWS 8 CHAP. 11 applied to Windows Phone 8, which shares most of the core binaries with desktop and server Windows. Support of phones and tablets by Windows required support for the popular ARM architecture, as well as new Intel processors targeting those devices. What makes Windows 8 part of the M...
clipped_os_Page_864_Chunk7081
SEC. 11.2 PROGRAMMING WINDOWS 865 Hardware abstraction layer (hal.dll) Hypervisor (hvix, hvax) Drivers: devices, file systems, network NTOS executive layer (ntoskrnl.exe) GUI driver (Win32k.sys) NTOS kernel layer (ntoskrnl.exe) Kernel mode User mode Native NT API, C/C++ run-time (ntdll.dll) NT services: smss, lsass, se...
clipped_os_Page_865_Chunk7082
866 CASE STUDY 2: WINDOWS 8 CHAP. 11 shifting programmers away from a threading model to a task model in order to dis- entangle resource management (priorities, processor affinities) from the pro- gramming model (specifying concurrent activities). Other omitted Win32 APIs in- clude most of the Win32 virtual memory APIs...
clipped_os_Page_866_Chunk7083
SEC. 11.2 PROGRAMMING WINDOWS 867 the only remaining subsystem supported, Windows still maintains the subsystem model, including the csrss.exe Win32 subsystem process. Subsystem process Program process Subsystem libraries Subsystem run-time library (CreateProcess hook) Subsystem kernel support NTOS Executive Local proc...
clipped_os_Page_867_Chunk7084
868 CASE STUDY 2: WINDOWS 8 CHAP. 11 11.2.1 The Native NT Application Programming Interface Like all other operating systems, Windows has a set of system calls it can per- form. In Windows, these are implemented in the NTOS executive layer that runs in kernel mode. Microsoft has published very few of the details of the...
clipped_os_Page_868_Chunk7085
SEC. 11.2 PROGRAMMING WINDOWS 869 access requested. When handles are duplicated between processes, new access restrictions can be added that are specific to the duplicated handle. Thus, a process can duplicate a read-write handle and turn it into a read-only version in the target process. Not all system-created data st...
clipped_os_Page_869_Chunk7086
870 CASE STUDY 2: WINDOWS 8 CHAP. 11 devices, processes, and interprocess communication (IPC) facilities like shared memory, message ports, semaphores, and I/O devices. In UNIX there are a variety of ways of naming and accessing objects, such as file descriptors, process IDs, and integer IDs for SystemV IPC objects, an...
clipped_os_Page_870_Chunk7087
SEC. 11.2 PROGRAMMING WINDOWS 871 handle for the object. Such objects can even extend the NT namespace by provid- ing parse routines that allow the objects to function somewhat like mount points in UNIX. File systems and the registry use this facility to mount volumes and hives onto the NT namespace. Accessing the devi...
clipped_os_Page_871_Chunk7088
872 CASE STUDY 2: WINDOWS 8 CHAP. 11 Win32 call Native NT API call CreateProcess NtCreateProcess CreateThread NtCreateThread SuspendThread NtSuspendThread CreateSemaphore NtCreateSemaphore ReadFile NtReadFile DeleteFile NtSetInfor mationFile CreateFileMapping NtCreateSection Vir tualAlloc NtAllocateVir tualMemory MapVi...
clipped_os_Page_872_Chunk7089
SEC. 11.2 PROGRAMMING WINDOWS 873 Win32 has calls for creating and managing both processes and threads. There are also many calls that relate to interprocess communication, such as creating, de- stroying, and using mutexes, semaphores, events, communication ports, and other IPC objects. Although much of the memory-mana...
clipped_os_Page_873_Chunk7090
874 CASE STUDY 2: WINDOWS 8 CHAP. 11 storage. Modifications to files or directory subtrees can be detected through a noti- fication mechanism, or by reading the journal that NTFS maintains for each vol- ume. Each file-system volume is implicitly mounted in the NT namespace, accord- ing to the name given to the volume, ...
clipped_os_Page_874_Chunk7091
SEC. 11.2 PROGRAMMING WINDOWS 875 drawing geometric figures, filling them in, managing the color palettes they use, dealing with fonts, and placing icons on the screen. Finally, there are calls for dealing with the keyboard, mouse and other human-input devices as well as audio, printing, and other output devices. The G...
clipped_os_Page_875_Chunk7092
876 CASE STUDY 2: WINDOWS 8 CHAP. 11 Hive file Mounted name Use SYSTEM HKLM \SYSTEM OS configuration infor mation, used by ker nel HARDWARE HKLM \HARDWARE In-memory hive recording hardware detected BCD HKLM \BCD* Boot Configuration Database SAM HKLM \SAM Local user account infor mation SECURITY HKLM \SECURITY lsass’ ac...
clipped_os_Page_876_Chunk7093
SEC. 11.2 PROGRAMMING WINDOWS 877 Win32 API function Description RegCreateKeyEx Create a new registr y key RegDeleteKey Delete a registry key RegOpenKeyEx Open a key to get a handle to it RegEnumKeyEx Enumerate the subkeys subordinate to the key of the handle RegQuer yValueEx Look up the data for a value within a key F...
clipped_os_Page_877_Chunk7094
878 CASE STUDY 2: WINDOWS 8 CHAP. 11 The division of NTOS into kernel and executive is a reflection of NT’s VAX/VMS roots. The VMS operating system, which was also designed by Cutler, had four hardware-enforced layers: user, supervisor, executive, and kernel corres- ponding to the four protection modes provided by the ...
clipped_os_Page_878_Chunk7095
SEC. 11.3 SYSTEM STRUCTURE 879 firmware represents configuration information and deals with differences in the CPU support chips, such as various interrupt controllers. The lowest software layer is the hypervisor, which Windows calls Hyper-V. The hypervisor is an optional feature (not shown in Fig. 11-11). It is availa...
clipped_os_Page_879_Chunk7096
880 CASE STUDY 2: WINDOWS 8 CHAP. 11 The Hardware Abstraction Layer One goal of Windows is to make the system portable across hardware plat- forms. Ideally, to bring up an operating system on a new type of computer system it should be possible to just recompile the operating system on the new platform. Unfortunately, i...
clipped_os_Page_880_Chunk7097
SEC. 11.3 SYSTEM STRUCTURE 881 By using the HAL services and not addressing the hardware directly, drivers and the kernel require fewer changes when being ported to new processors—and in most cases can run unmodified on systems with the same processor architecture, despite differences in versions and support chips. The...
clipped_os_Page_881_Chunk7098
882 CASE STUDY 2: WINDOWS 8 CHAP. 11 way, without having to know anything about which interrupt vector is for which bus. Interrupt request level management is also handled in the HAL. Another HAL service is setting up and managing DMA transfers in a de- vice-independent way. Both the systemwide DMA engine and DMA engin...
clipped_os_Page_882_Chunk7099
SEC. 11.3 SYSTEM STRUCTURE 883 ntoskrnl.exe file which contains NTOS, the core of the Windows operating system. Or it can refer to the kernel layer within NTOS, which is how we use it in this sec- tion. It is even used to name the user-mode Win32 library that provides the wrap- pers for the native system calls: kernel3...
clipped_os_Page_883_Chunk7100