abstraction.txt (2232B)
1 ------------------------------------------------------------------------------- 2 Abstraction 3 ------------------------------------------------------------------------------- 4 5 The use of abstractions is one of the most important concepts in computer 6 science. For example, one aspect of good programming practice is to formulate a 7 simple application program interface (API) for a set of functions that allow 8 programmers to use the code without having to delve into its inner workings. 9 Different programming languages provide different forms and levels of support 10 for abstraction, such as Rust's trait definitions and module system with 11 explicit pub visibility boundaries. 12 13 ------------------------------------------------------------------------------- 14 Abstractions provided by a computer system 15 ------------------------------------------------------------------------------- 16 17 We are probably familiar with several of the abstractions seen in computer 18 systems. On the processor side, the instruction set architecture provides an 19 abstraction of the actual processor hardware. With this abstraction, a 20 machine-code program behaves as if it were executed on a processor that performs 21 just one instruction at a time. The underlying hardware is far more elaborate, 22 executing multiple instructions in parallel, but always in a way that is 23 consistent with the simple, sequential model. By keeping the same execution 24 model, different processor implementations can execute the same machine code 25 while offering a range of cost and performance. 26 27 On the operating system side, we have introduced three abstractions: files as an 28 abstraction of I/O devices, virtual memory as an abstraction of program memory, 29 and processes as an abstraction of a running program. To these abstractions we 30 add a new one: the virtual machine, providing an abstraction of the entire 31 computer, including the operating system, the processor, and the programs. The 32 idea of a virtual machine was introduced by IBM in the 1960s, but it has become 33 more prominent recently as a way to manage computers that must be able to run 34 programs designed for multiple operating systems (such as Microsoft Windows, Mac 35 OS X, and Linux) or different versions of the same operating system.