VE482 — Introduction to Operating Systems Assignment 3 solved

$35.00

Category: You will receive a download link of the .ZIP file upon Payment

Description

5/5 - (1 vote)

Ex. 1 — Research on POSIX
Write a few paragraphs about the POSIX standards. What are they, why do they exist, what kind of
things are included in the norms.
Ex. 2 — General questions
1. Why would a thread voluntarily release the CPU?
2. What is the biggest advantage/disadvantage of user space threads?
3. If a multithreaded process forks, a problem occurs if the child gets copies of all the parent’s
threads. Suppose that one of the original threads was waiting for keyboard input. Now two
threads are waiting for keyboard input, one in each process. Does this problem ever occur in
single-threaded processes?
4. Many UNIX system calls have no Win32 API equivalents. For each such call, what are the
consequences when porting a program from a UNIX system to a Windows system?
Ex. 3 — C programming
The goal of this exercise is to improve the programming skills and get more familiar with pointers and
function pointers.
1. Implement a linked list structure containing two pointers of type char and void, respectively. It
should be possible to at least add elements to the list.
2. Knowing that the void pointer in the structure could contain some char*, int, or double, write
a search function for this linked list.
3. The linked list will store elements read from an ASCII file where each line is in the format
somestring=somedata. The type of the data is defined in the filename; for instance a file
containing unsorted integers will be named rand int.txt. Implement the necessary functions to
read and write such files.
4. Use a function pointers to compare and sort the elements from the structure with respect to
the data field. Implement the following sorting orders: increasing, decreasing, and random. The
filename is sortingtype dataype.txt, where sortingtype is rand, inc, or dec.
5. Write a function to test the implementation.
Sample output:
$ cat rand˙int.txt
acb=148
bac=234
ghi=9
$ ./ex3 rand˙int.txt inc
reading rand˙int.txt
sorting elements
writing inc˙int.txt
$ cat inc˙int.txt
ghi=9
acb=148
bac=234