Difference between revisions of "Operating Systems 2015F: Assignment 3"

From Soma-notes
Jump to navigation Jump to search
(Created page with "Please answer the following questions on cuLearn by 8 PM on Tuesday, October 6th. # What is something that userspace programs can do easily that is difficult to do from kerne...")
 
 
(9 intermediate revisions by the same user not shown)
Line 1: Line 1:
Please answer the following questions on cuLearn by 8 PM on Tuesday, October 6th.
Please answer the following questions on cuLearn by 8 PM on Tuesday, October 6th.


# Standard C library routines such as printf are available in the kernel. True or False
# Without errors, what does the fork system call return?
#* the child’s process ID
#* 0
#* Both (a) and (b)
#* None of the above.
# What is something that userspace programs can do easily that is difficult to do from kernel code?
# What is something that userspace programs can do easily that is difficult to do from kernel code?
#* Open a file
#* Open a file
Line 10: Line 16:
#* function calls are too slow
#* function calls are too slow
#* processes cannot see kernel memory
#* processes cannot see kernel memory
#* All of the above
# You can create a new process running an executable by...
# You can create a new process running an executable by...
#* making an execve system call
#* making an execve system call
Line 15: Line 22:
#* Both A and B
#* Both A and B
#* None of the above
#* None of the above
#Which of the following is a character/stream device?
# Which of the following is normally assigned character/stream device on UNIX-like systems?
#* Hard Disk drive
#* Hard Disk drive
#* Sound card (audio device)
#* Sound card (audio device)
#* DVD drive
#* DVD drive
#* All of the above
#* All of the above
# In playing around with the dd command in /dev you accidentally overwrote a small part of a USB drive formatted with an ext4 filesystem.  You run fsck and repair the filesystem.  No files have been corrupted; however, you find a directory that had a few files is now empty, and its files have now appeared  /lost+found but with seemingly random numeric filenames (like #5123).  What part of the filesystem did you overwrite?
# If a process makes many system calls (as seen by strace) but produces no library calls (as seen by ltrace), what is a reasonable assumption regarding the process and the program it is running?
#* Data blocks
#* The program is multithreaded
#* inodes
#* The dynamic linker is broken
#* The process is running as root
#* The program was statically linked
# If a process creates many child processes then changes an environment variable X...
#* X is also changed in its parent process
#* X is changed in all child processes
#* Wait, a process cannot change its environment variables
#* None of the above
# In playing around with the dd command in /dev you accidentally overwrote a small part of a USB drive formatted with an ext4 filesystem.  You run fsck and repair the filesystem.  No files have been corrupted; however, you find a directory that had a few files is now empty, and its files have now appeared  /lost+found but with seemingly random numeric filenames (like #5123).  What part of the filesystem do you know you overwrote?
#* data blocks
#* inode blocks
#* directory blocks
#* directory blocks
#* All of the above
#* All of the above
Line 30: Line 47:
#* lost+found contains the old A, B, and C
#* lost+found contains the old A, B, and C
#* None of the above.
#* None of the above.
==Solutions==
# Standard C library routines such as printf are available in the kernel. '''False'''
# Without errors, what does the fork system call return?
# Without errors, what does the fork system call return?
## the child’s process ID
#* the child’s process ID
## 0
#* 0
## Both (a) and (b)
#* '''Both (a) and (b)'''
## None of the above.
#* None of the above.
 
# What is something that userspace programs can do easily that is difficult to do from kernel code?
 
#* Open a file
If a process creates many child processes then changes an environment variable X...
#* Display text on the screen
* X is also changed in its parent process
#* Send data over a socket
* X is changed in all child processes
#* '''All of the above'''
* Wait, a process cannot change its environment variables
# System calls are used to access the kernel because...
* None of the above
#* The kernel runs in a separate process
 
#* function calls are too slow
 
#* '''processes cannot see kernel memory'''
Standard C library routines such as printf are available in the kernel. true or false
#* All of the above
 
# You can create a new process running an executable by...
 
#* making an execve system call
If a process makes many system calls (as seen by strace) but produces no library calls (as seen by ltrace), what is a reasonable assumption regarding the program?
#* making a fork system call
 
#* '''Both A and B'''
* The process is multithreaded
#* None of the above
* The dynamic linker is broken
# Which of the following is normally assigned character/stream device on UNIX-like systems?
* The process is running as root
#* Hard Disk drive
* The process was statically linked
#* '''Sound card (audio device)'''
#* DVD drive
#* All of the above
# If a process makes many system calls (as seen by strace) but produces no library calls (as seen by ltrace), what is a reasonable assumption regarding the process and the program it is running?
#* The program is multithreaded
#* The dynamic linker is broken
#* The process is running as root
#* '''The program was statically linked'''
# If a process creates many child processes then changes an environment variable X...
#* X is also changed in its parent process
#* X is changed in all child processes
#* Wait, a process cannot change its environment variables
#* '''None of the above'''
# In playing around with the dd command in /dev you accidentally overwrote a small part of a USB drive formatted with an ext4 filesystem.  You run fsck and repair the filesystem.  No files have been corrupted; however, you find a directory that had a few files is now empty, and its files have now appeared  /lost+found but with seemingly random numeric filenames (like #5123).  What part of the filesystem do you know you overwrote?
#* data blocks
#* inode blocks
#* '''directory blocks'''
#* All of the above
# There is a directory called /mydisk, and in this directory there are three files, A, B, and C.  You run the command "mount /dev/sdb1 /mydisk"; afterwards you see that /mydisk contains the file B along with a directory lost+found. We see the file B but not the files A and C because...
#* '''A, B, and C still exist but are now hidden; the file B that we see is a different file that just happens to have the same filename B.'''
#* A and C got randomly erased by the mount command but B was left alone.
#* lost+found contains the old A, B, and C
#* None of the above.

Latest revision as of 10:14, 7 October 2015

Please answer the following questions on cuLearn by 8 PM on Tuesday, October 6th.

  1. Standard C library routines such as printf are available in the kernel. True or False
  2. Without errors, what does the fork system call return?
    • the child’s process ID
    • 0
    • Both (a) and (b)
    • None of the above.
  3. What is something that userspace programs can do easily that is difficult to do from kernel code?
    • Open a file
    • Display text on the screen
    • Send data over a socket
    • All of the above
  4. System calls are used to access the kernel because...
    • The kernel runs in a separate process
    • function calls are too slow
    • processes cannot see kernel memory
    • All of the above
  5. You can create a new process running an executable by...
    • making an execve system call
    • making a fork system call
    • Both A and B
    • None of the above
  6. Which of the following is normally assigned character/stream device on UNIX-like systems?
    • Hard Disk drive
    • Sound card (audio device)
    • DVD drive
    • All of the above
  7. If a process makes many system calls (as seen by strace) but produces no library calls (as seen by ltrace), what is a reasonable assumption regarding the process and the program it is running?
    • The program is multithreaded
    • The dynamic linker is broken
    • The process is running as root
    • The program was statically linked
  8. If a process creates many child processes then changes an environment variable X...
    • X is also changed in its parent process
    • X is changed in all child processes
    • Wait, a process cannot change its environment variables
    • None of the above
  9. In playing around with the dd command in /dev you accidentally overwrote a small part of a USB drive formatted with an ext4 filesystem. You run fsck and repair the filesystem. No files have been corrupted; however, you find a directory that had a few files is now empty, and its files have now appeared /lost+found but with seemingly random numeric filenames (like #5123). What part of the filesystem do you know you overwrote?
    • data blocks
    • inode blocks
    • directory blocks
    • All of the above
  10. There is a directory called /mydisk, and in this directory there are three files, A, B, and C. You run the command "mount /dev/sdb1 /mydisk"; afterwards you see that /mydisk contains the file B along with a directory lost+found. We see the file B but not the files A and C because...
    • A, B, and C still exist but are now hidden; the file B that we see is a different file that just happens to have the same filename B.
    • A and C got randomly erased by the mount command but B was left alone.
    • lost+found contains the old A, B, and C
    • None of the above.

Solutions

  1. Standard C library routines such as printf are available in the kernel. False
  2. Without errors, what does the fork system call return?
    • the child’s process ID
    • 0
    • Both (a) and (b)
    • None of the above.
  3. What is something that userspace programs can do easily that is difficult to do from kernel code?
    • Open a file
    • Display text on the screen
    • Send data over a socket
    • All of the above
  4. System calls are used to access the kernel because...
    • The kernel runs in a separate process
    • function calls are too slow
    • processes cannot see kernel memory
    • All of the above
  5. You can create a new process running an executable by...
    • making an execve system call
    • making a fork system call
    • Both A and B
    • None of the above
  6. Which of the following is normally assigned character/stream device on UNIX-like systems?
    • Hard Disk drive
    • Sound card (audio device)
    • DVD drive
    • All of the above
  7. If a process makes many system calls (as seen by strace) but produces no library calls (as seen by ltrace), what is a reasonable assumption regarding the process and the program it is running?
    • The program is multithreaded
    • The dynamic linker is broken
    • The process is running as root
    • The program was statically linked
  8. If a process creates many child processes then changes an environment variable X...
    • X is also changed in its parent process
    • X is changed in all child processes
    • Wait, a process cannot change its environment variables
    • None of the above
  9. In playing around with the dd command in /dev you accidentally overwrote a small part of a USB drive formatted with an ext4 filesystem. You run fsck and repair the filesystem. No files have been corrupted; however, you find a directory that had a few files is now empty, and its files have now appeared /lost+found but with seemingly random numeric filenames (like #5123). What part of the filesystem do you know you overwrote?
    • data blocks
    • inode blocks
    • directory blocks
    • All of the above
  10. There is a directory called /mydisk, and in this directory there are three files, A, B, and C. You run the command "mount /dev/sdb1 /mydisk"; afterwards you see that /mydisk contains the file B along with a directory lost+found. We see the file B but not the files A and C because...
    • A, B, and C still exist but are now hidden; the file B that we see is a different file that just happens to have the same filename B.
    • A and C got randomly erased by the mount command but B was left alone.
    • lost+found contains the old A, B, and C
    • None of the above.