Docsity

Solved Homework for Operating System Design and Implementation | CS 551, Study notes of Operating Systems

Toggle sidebar
bg1
CS551- Operating system design and Implementation
Solutions for Homework1
Sol 1.2:
In kernel mode, every machine instruction is allowed, as is access to all
the I/O devices. In user mode, many sensitive instructions are prohibited. Operating
systems use these two modes to encapsulate user programs. Running user programs in
user mode keeps them from doing I/O and prevents them from interfering with each other
and with the kernel.
Sol 1.7:
Choices (a), (c), and (d) should be restricted to kernel mode.
Sol 1.15:
The read works normally. User 2’s directory entry contains a pointer to the i-node
of the file, and the reference count in the i-node was incremented when user 2 linked to it.
So the reference count will be nonzero and the file itself will not be removed when user 1
removes his directory entry for it. Only when all directory entries for a file have been
removed will its i-node and data actually vanish.
Sol 1.19:
If an ordinary user could set the root directory anywhere in the tree, he could
create a file etc/passwd in his home directory, and then make that the root directory. He
could then execute some command, such as su or login that reads the password file, and
trick the system into using his password file, instead of the real one.
Sol 1.22:
No, unlink removes any file, whether it be for a regular file or a special file.
Sol 1.23:
When a user program writes on a file, the data does not really go to the disk. It
goes to the buffer cache. The update program issues SYNC calls every 30 seconds to
force the dirty blocks in the cache onto the disk, in order to limit the potential damage
that a system crash could cause.
Sol 1.25:
Yes it can, especially if the system is a message passing system.

Partial preview of the text

Download Solved Homework for Operating System Design and Implementation | CS 551 and more Study notes Operating Systems in PDF only on Docsity!

CS551- Operating system design and Implementation Solutions for Homework Sol 1.2: In kernel mode, every machine instruction is allowed, as is access to all the I/O devices. In user mode, many sensitive instructions are prohibited. Operating systems use these two modes to encapsulate user programs. Running user programs in user mode keeps them from doing I/O and prevents them from interfering with each other and with the kernel. Sol 1.7 : Choices (a), (c), and (d) should be restricted to kernel mode. Sol 1.15 : The read works normally. User 2’s directory entry contains a pointer to the i-node of the file, and the reference count in the i-node was incremented when user 2 linked to it. So the reference count will be nonzero and the file itself will not be removed when user 1 removes his directory entry for it. Only when all directory entries for a file have been removed will its i-node and data actually vanish. Sol 1.19 : If an ordinary user could set the root directory anywhere in the tree, he could create a file etc/passwd in his home directory, and then make that the root directory. He could then execute some command, such as su or login that reads the password file, and trick the system into using his password file, instead of the real one. Sol 1.22 : No, unlink removes any file, whether it be for a regular file or a special file. Sol 1.23 : When a user program writes on a file, the data does not really go to the disk. It goes to the buffer cache. The update program issues SYNC calls every 30 seconds to force the dirty blocks in the cache onto the disk, in order to limit the potential damage that a system crash could cause. Sol 1.25 : Yes it can, especially if the system is a message passing system.