For the following system calls provide a reason or condition

For the following system calls, provide a reason (or condition) that causes it to fail:

read();

write();

fork();

close();

waitpid();

Solution

(a) read(): Read can fail on a closed file handle, end of file already read, a bad string (buffer) pointer, or a file not opened for reading. Problems reading the file itself can also cause failure (disk failure, for example).

(b) write(): Write can fail on a closed file handle, file not opened for writing, bad string pointer, lack of space on the device, or I/O error.

(c) close(): You give close an incorrect file handle/descriptor.

(d) fork(): Fork can fail if there are too many processes (either for this user for the whole operating system) or if there’s not enough memory.

(e) waitpid(): Waitpid will fail if the process id given to it no longer exists.

For the following system calls, provide a reason (or condition) that causes it to fail: read(); write(); fork(); close(); waitpid();Solution(a) read(): Read can

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site