True or False and briefly explain why
a) Cache is usually faster than main memory.

True.

Cache memory is directly connected to the central processing unit(CPU). Retrieval from cache takes far smaller amount of  CPU circles than retrieving from main memory. There is wait or delay for access to memory, which could take several CPU cycles because of the memory controller technology implemented in the chipset. The way RAM works also contributes to how slow it works as compared to cache.

b) Main memory is usually more expensive than cache.

False.

Cache memory is usually more expensive than main memory. Cache memory is expensive because its faster and the memory technology used in cache is different from that of main memory.

Briefly answer the following questions:

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

Multicore computer systems  have multiple computing cores on a single chip, where each core appears as a separate processor to the operating system. Multi processor computer systems on the other hand have multiple CPU plugged into sockets on the motherboard. Multi core computer systems usually have separate L1 Cache but may share L2 Cache and memory, but multi processor computer systems do not share any cache, but shared only main memory.

Given the two computer systems with the same processor capacity, Multicore computer systems will run faster in executing multithreaded programs because the processors in the multicore are closer to each other resulting in faster communication and exchange of data. The shared L2 cache in multicore computer systems also increase speed because there is minimal or no cache coherence problem as compared to multiprocessor computer systems.

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

To migrate an integer from magnetic tape to processor register, an I/O operation is issued by the process that needs the integer. The disk block containing the integer is copied into main memory. This is followed by copying the integer from main memory to cache. A copy is then made of the integer in cache to the processor register. At this time, there are various copies of the integer but when it is updated by the calling process in the register, the current value in the register is the most up to date value of the integer and that’s what will be served to other calling processes.

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

Speed, Cost and Volatility(Reliability).

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

Using API instead of making system calls directly allows for program portability  because programs written to comply with the API are expected to be able to be compiled and ran in any system. Another advantage of programming using the API rather than making system calls directly is that,  it’s more detailed and difficult to make system calls than working with API. Programmers do not have to worry about the details of making systems when using the API because there often exists a strong correlation between a function in the API and its associated system call within the kernel.

However, using API rather than directly making system calls is a trade off for speed in some situations. System calls are codes that are directly executed by the supporting platform, so the speed at which this code executes is very fast as compared to interpreting applications written using the API which eventually have to be assigned to specific functions or operations in the system call engine. In correctly programming in API will also result in failure in the system.

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.

The services provided by OS are as follows;

  • User interface : The OS provides an interface convenient for users to easily access and use the resources available on the computer. The interface can take several forms such as DTrace Command line-interface and batch interface. Graphical user interface is the most used interface on most modern computers. Some systems can implement more than one of these interfaces to facilitate the use of system resources,  such as Windows 7.
  • Program execution: The OS must be able to load a program into  memory and to run that program. The program must be able to end its execution once it’s task is completed, either normally or abnormally. The program must indicate error in abnormal terminations.
  • I/O operations: The OS must provide a means to do input and output operations because users do not usually have control over devices that perform such operations due to efficiency and protection of the system.
  • File-system manipulation: The OS must provide platform for programs to read and write files and directories. Users also need to create and delete files and directories, search and list file information, maintain ownership and permissions management for files and directories. Different OS handles file-system manipulation differently to provide specific features or performance characteristics.
  • Communication: The OS must provide means for process on same computer or different computers over a network to communicate and exchange data when needed. Communication can be implemented via shared memory or through message parsing, in which packets of information are moved between processes by the OS.
  • Error detection: The OS must be constantly aware of any error in the system. It must know when there is error in CPU, memory, I/O devices and in user programs. The OS must be able to take appropriate action to correct each type of error and ensure correct and efficient computing.

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?

CPU Bound means the rate at which process progresses is limited by the speed of the CPU. A task that performs calculations on a small set of numbers, for example multiplying small matrices, is likely to be CPU bound. The only operation that involves such calculation is (c) factoring.

On the other hand I/O Bound means the rate at which a process progresses is limited by the speed of the I/O subsystem. A task that processes data from disk, for example, counting the number of lines in a file is likely to be I/O bound. The rest of the procedures are I/O bound because they are affected by the I/O subsystem. These are a) read-integer-from-user, b) read-prime-factors-from-file, d)save-new-prime-factors-to-file, e) print-all-factors-to-user.

Leave a Reply

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

Name *