![]() College of Engineering & CS Wright State University Dayton, Ohio 45435-0001 |
|
1a) Argc, argv, and envp are available to all Unix programs. The signature of the main routine
controls what is actually accepted. Int main (void) accepts none, where as int main
(int argc, char *argv, char ** envp) accepts all 3.
1b) True. On inode based fs's where disk space is allocated in blocks you get internal fragmentation
problems. Similarly, with paging, parts of a page may go unused resulting in internal fragmentation.
If a fs uses contiguous allocation, we encounter the problem of external frag. Similarly with a VM
system built on straight segmentation, since segments are of multiple sizes, and without compaction,
these could be free mem, that is non-contiguous but would be large enough otherwise to satisfy a
request. This is also external frag.
1c) Program structure most certainly has an affect on performance. Consider a 2 x 2 array of 100
columns and 100 rows. If 1 page holds each row and the process is allocated less than 100 pages of
mem then
for (all columns)
for (all rows)
array [row] (column) = 0
could generate up to 100 x 100 pages faults. Simply switching the row and column vars to for (all rows) for (all columns)
would only product up to 100 page faults which is a significant savings.
1d) Good disk head scheduling increases the throughput. Individual process performance may suffer,
but system wide, the disk will spend more time actually transferring data than seeking which is what
we want. So, overall disk head scheduling may not improve individual process performance, but will
increase total system throughput and performance.
1e) Support for virtual mem (VM) is not just up to the OS. The hardware needs to provide some help in the form of PTBR, PTLR registers, and some TLBs for performance. Other hardware help is
needed so implement segmentation on top of paging. DOS was originally written for an early Intel
architecture that didn't have hardware support for VM. I suppose it would be possible now, to change
DOS to take advantage of the currently provided VM support in Intel chips.
1f) I suppose it would be possible to write a system for paging where page sizes orient powers of 2
but it would not be a good idea. Page size must be the same as a frame size and RAM (physical mem)
comes in powers of 2; 2MB, 128MB, 512MB, etc. So, non-power of 2 sizes wouldn't fit evenly into
RAM. Besides, powers of 2 are easier to work with. Segments do not have to be in powers of 2.
They are either fit into RAM wherever there is enough space (holes) or implemented on top of paging.
| October 10, 2001 |