心得分享

Card image cap

王同學 報告/作業 分享經驗 10/14 10/8 os作業

10/14 10/8 os作業
名稱 10/8 os作業
日期 10/14
課程名稱 作業系統
指導教師 劉艾華

1.
(a). There is one reason for a cache to exist: speed. A cache exists to speed up the time that the processor takes to obtain a bit of data. Typically, main memory is many times slower than the processor - in modern computers, it can be 1000 times slower. So, caches are made up of memory more expensive and faster than main memory, to store parts of main memory in, in the hopes that the data the processor wants will be available in the cache.
(b). Cache solve the transfer problems by providing a buffer of intermediate speed between the components.
(c). The main problem of cache is to be updated, e.g: you must have noticed that if the websites you visited for the first time takes more time opening of sites you open daily, this is because computer catch the cache copy of that site, but if due to any reason you are unable to connect to your internet connection, and an error occurs, that error page is saved as cache copy for that site, it opens error page insist of going to actual site, even when your internet connection is working, (for that you have to update your cache or remove the data from cache).
(d). Though the size of a cache has increased over time, so too has the size of hard disk. An economical comparison of cache versus hard disk space in a cost per MB analsysis will show that a cache would be significantly more expensive. Furthermore, cache in general is considered "temporary" or volatile storage which means that the contents of the storage device is lost when the system is powered off. A hard disk, on the other hand, is "long term" or non-volatile storage; when the system is powered off, the hard disk still safely holds the data stored on it.
2.
(a). An interrupt is a signal from hardware (h/w interrupt) or software (s/w interrupt) to indicate the occurence of an event. It indicates the need of a change in execution. Interrupt handling or servicing of the interrupts depends upon the design of the operating system. A routine which will be called for servicing the interrupt is known as interrupt service routine or ISR and the request for the ISR through an interrupt is known as interrupt request or IRQ. Interrupt is a mechanism used for implementing the multitasking concept. It will use the concept of context switching, for servicing the request.
(b). Trap is actually a software generated interrupt caused either by an error (for example division by zero, invalid memory access etc.), or by an specific request by an operating system service generated by a user program. Trap is sometimes called Exception. The hardware or software can generate these interrupts. When the interrupt or trap occurs, the hardware therefore, transfer control to the operating system which first preserves the current state of the system by saving the current CPU registers contents and program counter's value. after this, the focus shifts to the determination of which type of interrupt has occured. For each type of interrupt, separate segmants of code in the operating system determine what action should be taken and thus the system keeps on functioning by executing coputational instruction, I/O instruction, torage instruction etc.
(c). Yes.
(d). User programs create traps for debugging purposes. A trap can be used to call the OS routines or to catch arithmetic errors.
3.
(a). The differences between CPU and device controller is that CPU is the device,which controls all the operations, but device controller translates software input into something a hardware device understands.CPU and device controllers all use a common bus for communication
(b). A device controller is a part of a computer system that makes sense of the signals going to, and coming from the CPU.
4.
First, the device driver will load the appropriate registers within the device controller. Then, the device controller examines the contents of these registers to determine what action to take. The device controller starts to transfer data form the device to its local buffer. When the transfer is complete, the device controller will send interrupt to device driver. The device driver then returns control to the operating system.

更新日期:2015/10/15 上午 07:37:14