Guidance from: http://askubuntu.com/questions/26632/how-to-install-eclipse
- For example, “rm file.txt”
- It would search for a file called rm, load the file into memory, and execute it with the parameter file.txt.
- A bit, called mode bit, is added to the hardware of the computer to indicate current mode.
- 0: kernel mode
- When a task is executed on behalf of the operating system
- 1: user mode
- When a task is executed on behalf of the user
- Whenever a trap or interrupt occurs, the hardware switches from user mode to kernel mode
- i.e., change mode bit to 0
- When a user application requests a service from the operating system (via a system call)
- It must transition from user to kernel mode to fulfill the request
- Privileged Instructions
- The hardware allow privileged instructions to be executed only in kernel mode.
- The instruction to switch to kernel mode is an example of a privileged instruction. Some other example include I/O control, timer management, and interrupt management.
- For example, on Unix, the setuid attribute on a program cause that program to run with the user ID of the owner of the file, rather than the current user’s ID.
- It allows the execution of a process that is not completely in memory. So that it enables users to run programs that are larger than actual physical memory.
- In addition, it abstracts main memory into a larger, uniform array for storage, separating logical memory as viewed by the user from physical memory. This arrangement free programmers from concern over memory-storage limitations.
- A device controller is in charge of the devices.
- It maintains
- some local buffer
- and a set of special purpose registers
- It is responsible for moving the data between the peripheral devices that it is controls and its local buffer storage.
- The operating system has a device driver for each device controller
- This device driver understands the device controller and presents a uniform interface to the device to the rest of the operating system
Interrupt Driver IO
- The device driver loads the appropriate registers within the device controller.
- The device controller, in turn, examines the contents of these registers to determine what action to take.
- The controller starts the transfer of the data from the device to its local buffer.
- Once the transfer of data is complete, the device controller informs the device driver via an interrupt that it has finished its operation.
- The device driver then returns control to the operating system, possibly returning the data or a pointer to the data if the operation was a read.
- High overhead when used for bulk data movement such as disk I/O.
- To solve this problem, directed memory access (DMA) is used.
Directed Memory Access (DMA)
- After setting up buffer, pointers and counters for the I/O device, the device controller transfers an entire block of data directly to or from its own buffer storage to the memory, with no intervention by the CPU.
The occurrence of an event is usually signaled by an interrupt from either the hardware or the software.
- Hardware may trigger an interrupt at any time by sending signal to the CPU, usually by way of the system bus.
- Software (called Trap)
- Software may trigger an interrupt by executing a special operation called a system call.
- The Trap could be, e.g., division by zero, or invalid memory access
- Before the interrupt
- Before enter the interrupt, the return address will be stored on the system stack.
- After the interrupt
- After the interrupt is serviced, the saved return address is loaded into the program counter, and the interrupted computation resumes s through the interrupt had not occurred.
When a computer start running, i.e., when it is powered up or rebooted. it needs to have an initial program to run.
This initial program, or bootstrap program, tends to be simple. Typically, it is stored in read-only memory (ROM) or eletrically erasable programmable read-only memory (EEPROM), known by the general term firmware, within the computer hardware.
- For example, most computers don’t have an instruction to move a bit but do have one to move a byte
- For example, a computer may have instructions to move 64-bit (8-byte) words.
- 1024 Bytes
- (1024)^2 Bytes
- Usually round off as 1 million bytes
- (1024)^3 Bytes
- Usually round off as 1 billion bytes
CFP uses a concept called “sleeper fairness“,
- which considers sleeping or waiting tasks equivalent to those on the runqueue. This means that interactive tasks which spend most of their time
- So that the interactive tasks which spend most the their time waiting for user input or other events get a comparable share of CPU time when they need it.
- The data structure used for the scheduling algorithm is a red-black tree in which the nodes are scheduler-specific structures, entitled “sched_entity”.
- These are derived from the general task_struct process descriptor, with added scheduler elements. These nodes are indexed by processor execution time in nanoseconds.
- Idea Processor
- an “idea processor” would equally share processing power among all processes.
- Maximum execution time
- Thus the maximum execution time is the time the process has been waiting to run, divided by the total number of processes, or in the other words, the maximum execution time is the time the process would have expected to run on an “ideal processor”
- A maximum execution is also calculated for each process. This time is based upon the idea that an “idea processor” would equally share processing power among all processes.
- When the scheduler is invoked to run a new process, the operation o the scheduler is as follows
- The left most node of the scheduling tree is chosen (as it will have the lowest spent execution time), and sent for execution
- If the process simply completes execution, it is removed from the system and scheduling tree
- If the process reaches its maximum execution time or is otherwise stopped (voluntarily or via interrupt), it is reinserted into the scheduling tree based on its new spent executiom time.
- The new left-most node will then be selected from the tree, repeating the interation.