Write a program that prints the following information.
- Numbers of CPU cores
- CPU model name
- Total memory
- Average workload for previous 1min, 5min, and 15min
Write function ParseCommand() that parses command into arguments.
Write a simple command line interpreter that handles directory manipulation commands.
ex) mkdir, rmdir, cd, curdir, ls, quit
Write a program that displays the content of the current directory.
Write a C program that executes the following instructions.
- Read delay as a float number from command line arguments.
- Read arguments.c on the next page to learn how to access command line arguments.
- Use atof() to convert a string into the corresponding float number.
- Display current date and time
- Use time() and localtime() system calls and struct tm type.
- Read current time using gettimeofday() system call and store it in a variable of struct timeval type, start_time and end_time.
- Wait for delay using usleep()
- Display start_time and end_time in (sec usec) and hour:min:sec format
- Use localtime() system call
- Display the difference between start_time and end_time in seconds (including decimal parts)
Write a C program that prints the display.
- When executed without argument, display the following information
- User and process info
- User id, process id, parent’s process id
- Kernel info
- Sysname (OS name), nodename (hostname), release, version,machine
- System info
- Uptime, total ram, free ram, number of processes
- When executed with a filename, display the following information
- Permission of the file
- Permission to read, write, and execute
- Stat of the file
- Device id, inode number, mode (display as an octal number), user id, group id, access time, modification time, creation time
Write a C program that reads commands from a text file and run.
- Read the name of command file from command line arguments.
- Open the command file.
- Repeat.
- Read a text line from the file using ReadTextLine()
- If ReadTextLine() returns EOF, break the loop
- Display the command
- Parse command using ParseCommand()
- Run the commend
- If the commend is ‘cd’ change the current directory using chdir()
- If the first character of the command is ‘#’, ignore the command
- Otherwise, run the command on a child process using fork() and execvp(). Meanwhile, the parent process waits the child.
- Close the command file.
Write a program that draws or erases shape using the keyboard.
- ‘i’: move up, ‘j’: move left, ‘k’: move down, ‘l’: move right
- ‘c’: change color (‘*’ <-> ‘ ’)
- ‘q’: quit
Write two programs hw4_3a.c and hw4_3b.c extending hw4_1.c and hw4_2.c.
- hw4_3a read keys from the user and put them into a key buffer in a shared memory block
- hw4_3b draws or erases shapes according to the keys retrieved from the key buffer in the shared memory block
- hw4_3a and hw4_3b should communication through a key buffer implemented by POSIX shared memory system calls
ex) shm_open(), shm_unlink(), mmap(), munmap() functions
Practice Pointer and Dynamic allocation & deallocation.
Write a program that moves balls using multiple threads.
- Complete the skeleton code so that only one ball can enter in the critical region at a time.
Write the solution of the Dining Philosophers Problem
- Complete the skeleton code by synchronizing the philosophers and display function.
- Extend the solution to prevent deadlock by not allowing the ‘circular wait’ condition.
Write the solution of the Dining Philosophers Problem with Monitors.
Implement the address translation algorithm of a paging system.
- Address translation algorithm
- Separate page number and offset from logical address.
- With the page number, look up the page table to find the corresponding frame number.
- Combine frame number and offset to make physical address.