From b67ac830fa86a6e9bb474a159be03f3a26a12acd Mon Sep 17 00:00:00 2001 From: mo khan Date: Sat, 20 Mar 2021 13:01:19 -0600 Subject: finish notes on chapter 2 --- doc/2.md | 95 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 95 insertions(+) diff --git a/doc/2.md b/doc/2.md index ae42702..df6a1fd 100644 --- a/doc/2.md +++ b/doc/2.md @@ -619,3 +619,98 @@ and between the user and kernel layers). DTrace is composed of a compiler, a framework, `providers` of `probes` written within that framework, and `consumers` of those probes. + +## Operating-System Generation + +Operating systems are designed to runon any of a class of machines at a variety of sites with a +variety of peripheral configurations. The system must then be configured or generated +for each specific computer site, a process sometimes known as system generation `SYSGEN`. + +Operating systems are usually distributed as an ISO image, which if a file in the format +of a CD-ROM or DVD-ROM. To generate a system we use a special program. +The SYSGEN program reads from a given file, or asks the operator of the system for info +concerning the specific configuration of the hardware system, or probes the hardware +directly to determine what components are there. + +The following kinds of info mut be determined: + +* What CPU is to be used? +* What options are installed? e.g. extended instruction sets, floating point arithmetic +* How will the boot disk be formatted? +* How many sections or partitions will it be separated into? +* What will go in each partition? +* How much memory is available? +* What devices are available? +* What operating-system options are desired or what parameter values are to be used? + +Once this information is determined, it can be used in several ways. + +1. A sysadmin can modify a copy of the src to compile a custom copy of the OS. +1. A less tailored version can lead to the creation of tables and the selection of modules from a precompiled library. + +The major differences are the size and generality of the generated system and the easy of +modifying it as the hardware configuration changes. + +## System Boot + +How does the hardware know where the kernel is or how to load the kernel? +The procedure of starting a computer by loading the kernel is known as booting the system. + +On most computer systems, a small piece of code known as the bootstrap program or bootstrap loader +locates the kernel, loads it into main memory, and starts its execution. + +Some computer systems use a two-step process in which a simple bootstrap loader fetches a more +complex boot program from disk, which in turn loads the kernel. + +When a CPU receives a reset event the instruction register is loaded with a predefined +memory location, and execution starts there. At that location is the initial bootstrap +program. This program is in the form of read-only memory (ROM) because the RAM is in an unknown +state at system startup. ROM is convenient because it needs no initialization and cannot +easily be infected by a computer virus. + +The bootstrap program can run diagnostics to determine the state of the machine. +If the diagnostics pass, the program can continue with the booting steps. +It can also initialize all aspects of the system, from CPU registers to device controllers +and the contents of main memory. + +Some systems store the entire operating systems in ROM. +Storing the OS in ROM is suitable for small operating systems, +simple supporting hardware, and rugged operation. + +A problem with this approach is that changing the bootstrap code requires changing the ROM +hardware chips. Some systems use erasable programable read-only memory (EPROM), which +is read-only except when explicitly given a command to become writable. + +All forms of ROM are also known as firmware, since their characteristics fall somewhere +between those of hardware and those of software. Executing code on firmware is slower +than executing code in RAM. + +Some systems store the OS in firmware and copy it to RAM for fast execution. + +For large operating systems the bootstrap loader is stored in firmware and the operating +system is on disk. In this case, the bootstrap runs diagnostics and has a bit of code +that can read a single block at a fixed location from disk into memory and execute the +code from that boot block. + +The program stored in the boot block may be sophisticated enough to load the entire OS +into memory and begin its execution. + +GRUB is an example of an open-source bootstrap program for Linux systems. All of the +disk-bound bootstrap, and the operating system itself, can be easily changed by writing +new versions to disk. +A disk that has a boot partition is called a boot disk or system disk. + +Once the bootstrap program has been loaded, it can traverse the file system +to find the operating system kernel, load it into memory, and start its execution. +At this point the system is running. + +## Summary + +Operating systems provide a # of services. At the lowest level, system calls allow a running +program to make requests from the operating system directly. At a higher level, the command +interpreter or shell provides a mechanism for a user to issue a request without writing a +program. + +Commands may come from files during batch-mode execution or directly from a terminal +or desktop GUI when in an interactive or time-shared mode. System programs are provided +to satisfy many common user requests. -- cgit v1.2.3