Computer Systems 1st Chapter
C is the language of choice for system-level programming, and there is a huge installed base of application-level programs as well. However, it is not perfect for all the programmers adn all situations. C pointers are a common source of confusion and programming errors. C also lacks explicit support for useful abstractions such as classes, objects and expectations. Newer languages such as C++ and java address these issues for application-level.
Programs are translated by other programs into dffferent Forms.
hello.c (source program-text) >>>> Pre-processor(cpp) >>>>
hello.i (Modified source program-text) >>>> Compiler(cll) >>>>
hello.s(Assembly program-text) >>>> Assembler(as) >>>>
hello.o(Relocatable object program-binary)>>>> Linker (ld) >>>>
+printf.o
hello (Executable object program-binary)
Reasons to understand how compilation systems work:
1. optimizing program performance
2. Understanding link-time errors
3. Avoiding security holes
Hardware Organization of a System
Buses: Running throughout the system is a collection of electronical conduits called buses that carry bytes of information back and forth between the components. Buses jare typically designed to transfer fixed-sized chunks of bytes known as words.
I/O devices: Input/ Output (I/O) devices are the system's connection to the external world.
Main Memory: The main memory is a temporary storage device that holds both a program and the data it manipulates while the processor is executing the program.
Processor: The CPU or simply the processori is the engine that interprets or executes instructions stored in main memory.
Cashes Mater:
An important lesson from the simple example is that a system spends a lot of time moving information from one place to another. The machine instructions in the hello program are originally stored on disk. When the program is loaded they are copied to the main memory. As the processor runs the program, instructions are copied from main memory into the processor. Similarly, the data string "hello world\n" originally on diskm is copied to the main memory. and then copied from the main memory to the display device.
A process is the operating system's abstraction for a running program.
The operating system kernel serves an intermediary between the application and the hardware. It provides three fundamental abstractions:1. Files are abstractions for I/O divices. 2. Virtual memory is an abstraction for both main memory and disks. 3. Processes are abstraction for the processor, main memory and I/O devices.