DOC PREVIEW
UNO CSCI 8530 - System Initialization

This preview shows page 1-2-3 out of 10 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 10 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

11The Tempo-vm Operating SystemPart 4System Initialization2A Bare Machine• A bare machine doesn’t automatically begin executing the operating system and processes when the power switch is pushed.• Instead, it must go through “loads” of code before the first user process ever gets a chance to run.• The only code available to the CPU on powerupis found in various Read-Only Memories (ROMs).23ROMs Found in Machines• Most important contains BIOS: Basic I/O System (see next slide)• Other ROMs contain code (functions and data structures) that are unique to the I/O devices in the machine (called “option” ROMS):– video devices (usually called the video BIOS)– network interface cards (NICs), for network booting– disk adapter code (especially SCSI devices)4BIOS Startup Actions• POST – power-on self test– validate hardware configuration– identify devices (e.g. serial/parallel/USB ports, disk/CD/DVD drives, PnP devices, etc.)– invoke initialization code in option ROMs• Optional: allow user configuration• Search boot devices (in specified order) for a bootable device• Load first sector of bootable device in memory at 0x7c00 and transfer to it35Additional BIOS Features• In addition to getting the first sector of a bootable device into RAM, a BIOS provides a set of functions for performing simple input/output operations.• These usually operate in real mode without external interrupt support, and are intended primarily to help get an operating system into memory.• Only very simple operating systems will continue to use these functions after system startup.6An Aside on Standards• As an example of why standards are important, even in the BIOS world, consider the early days of PCs (using the Intel 8080 and the CP/M operating system, without any virtual memory or protection)• Most machines had ROM at a fixed location (high memory), and most CP/M applications were written to run starting at 0x100.• The Radio Shack TRS-80 computer had ROM in low-memory, and so application providers had to make a separate version for the TRS-80.47The Boot Sector• The boot sector (at least on IA-32) contains 512 bytes, including:– a jump instruction to location “x” (< 512)– a partition table (for hard disk partitions)– at “x”, code to read from additional disk sectors into memory and then jump to them– a “boot signature”, 0xaa55, that allows the BIOS to recognize a valid boot sector8Tempo’s Boot Sector• Since Tempo wasn’t designed to be booted from a hard disk (perhaps a bad decision that will be changed), the entire boot sector is used for code – there is no partition table.• The code (in bootstrap/bsp.s) loads the entire system into memory (starting at physical address 0x8000) and then transfers to it (at start, in realio.s)59Real Mode Startup (realio.s)• Setup the initial stack (grows downward from 0x8000)• Setup the TSS (Task State Segment) descriptor• Setups values to be used for the GDT (global descriptor table) and IDT (interrupt descriptor table) registers• Loads the GDT register• Switches to protected mode• Jumps to do_pm (kernel.s) to finish initialization10Protected Mode Initialization (kernel.s)• Set kernel segment registers• Set kernel stack pointer• Zero memory expected to be zero (by C)• Compute memory available in the system• Clear the display, show system version message, and setup the page map array• Initialize the keyboard• Load the IDT register• Initialize the priority interrupt controller(s), masking unused interrupts• Setup the interval timer• Turn on paging• Call “tempo” (in sys.c) – which never returns611Tempo (sys.c) – C Code, Finally!• We’re still in kernel mode, but we’re running code written in C.• “tempo” is responsible for major OS data structure initialization, creating the idle and first user process (which begins at Main), and then running the first user process.12OS Data Structures• OS data structures can be allocated in two ways:– statically: a fixed-sized pool (array) of typed objects, used as required and returned to the pool when no longer needed.– dynamically: available memory pool is untyped; pieces are allocated for objects as needed.• There are advantages and disadvantages to each approach.713Static Allocation Advantages• No memory fragmentation• Allocation and deallocation is fast• Code is simpler• Linear searches can be used to identify a specific object(s) in a pool of objects with the same type14Dynamic Allocation Advantages• All available memory can potentially be used; with static allocation, decisions must be made about the number of objects of each type before the system runs, and running out of one type of object can cause system failure, even though there may be unused memory in the pool of objects of a different type815Tempo’s Allocation Design• Tempo uses static allocation for the major OS data structures.• The size of the structures are defined in the h/sysparm.h file• Examples:#define NPROC 10 /* number of process table entries in proctab */#define NSEMA 20 /* number of semaphores in sematab */#define NMSGS 256 /* number of messages in msgtab */#define NQUEUE 8 /* number of message queues per process */#define NKEYS 128 /* maximum queued keyboard inputs */16OS Initialization (1)• Mark all process table entries as unused• Allocate first semaphore for CS macro• Allocate second semaphore for keyboard• Mark other semaphores as unused• Create pool of message nodes• Clear the ready queues (one for each prio)• If disk I/O is enabled, check for a hard disk and for a filesystem.917OS Initialization (2)• Set number of processes to 0• Set the sleep (“delta”) queue to empty• Clear the disk I/O request queue• Set pid for first process• Setup the idle process’ proctab entry; call “addready” to add it to its ready queue• Setup the Main process’ proctab entry; call “addready” to add it to its ready queue• Set activeProcess to NULL• Call xmain() to begin process execution18addready(Process p)•Processis equivalent to “struct Proc *”, a pointer to a proctab entry• The addready function:– sets the state of the process to ready– adds it to the end of the queue for its priority• Note that the “idle” process (pid = 0) has priority –1, so 1 is added to a process priority when indexing the array of ready queue head pointers


View Full Document

UNO CSCI 8530 - System Initialization

Download System Initialization
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view System Initialization and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view System Initialization 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?