1. True or False and briefly explain why

a) Cache is usually faster than main memory.

            b) Main memory is usually more expensive than cache.

 

a) True. Cache sits between memory and CPU and acts as a relay for faster access toward memory.

b) False. Main memory is not as expensive as cache, due to its lower speed and design.

 

2. Briefly answer the following questions:

a) What are the differences between multiprocessor computer systems and multicore computer systems?

            b) How does one integer migrate from magnetic tape into processor register?

            c) What metrics do we usually use to categorize different computer storages? [Hint: there are three such metrics]

            d) When writing application programs, what are the advantages and disadvantages of using API instead of making system calls directly?

 

a) Multiprocessor systems have multiple CPUs on one main board. These CPUs are then connected through bus to form the computer system. Multicore systems usually have one CPU with multiple cores. Multicore systems are more efficient because communication among cores take place on the same CPU chip. They are also more power efficient with only one CPU to power and cool, as compared to multiple CPUs to power and cool in multiprocessor systems.

 

b) Magnetic tape is a secondary storage. When an integer is read from magnetic tape, the number is first read into memory. Then it will be copied into cache and eventually to a register.

 

c) Speed; Cost; and Volatility.

 

d) The main advantage of using an API is that the programmer does not need to know the implementation details of the system call but just the parameters for it. This reduces programming complexity and improves programming speed significantly. On the other hand, the programmer will have less control over the system call implementation. Such a layered approach may lower a program’s performance.

 

3. The primary purpose of OS is to provide convenient interface and mechanisms for users to use the computer efficiently. Please list the main services that OS provides and briefly explain each.

 

Mainly, an OS provides the following services:

 

User interface: this allows users to access the services provided by the OS. It can vary from Command-Line (CLI), Graphics User Interface (GUI), and batch.

Program execution: an OS should be able to load a program into memory, run it, and exit normally or abnormally.

I/O operations: an OS should provide input/output device access to programs/users.

File-system: an OS should allow users to create, delete, move, copy files, among other activities.

Communication: an OS should allow exchange of information between different programs on the same host or programs on different hosts.

Error detection: an OS should be able handle program errors and/or CPU memory errors when occur.

Resource allocation: an OS should allow multiple users to run multiple programs concurrently, sharing the availability resources.

 

4. Assume you developed a program running in a loop to read large integers from the user and to find out all the prime factors of these integers. All the identified prime factors are saved to the same file and checked later whether they are factors of other integers. It was designed in such a way that five processes will be executed:

a) read-integer-from-user

b) read-prime-factors-from-file

c) factoring

d) save-new-prime-factors-to-file

e) print-all-factors-to-user

Which of the above are I/O-bound processes and which are CPU-bound processes? Why?

 

Processes for a), b), d), and e) are I/O-bound. Process c) is CPU-bound. The former set needs to access I/O while the latter set contains purely computational procedures.

Leave a Reply

Your email address will not be published. Required fields are marked *

Name *