Difference between revisions of "Operating Systems 2014F: Assignment 1"

From Soma-notes
Jump to navigation Jump to search
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
'''This Assignment is not yet finalized.'''
Please submit the answers to the following questions via CULearn by midnight on Wednesday, September 10, 2014.  There 10 points in 8 questions.


Please submit the answers to the following questions via CULearn by midnight on Wednesday, September 10, 2014.
Submit your answers as a single text file named "<username>-comp3000-assign1.txt" (where username is your MyCarletonOne username).  The first four lines of this file should be "COMP 3000 Assignment 1", your name, student number, and the date of submission.  You may wish to format your answers in [http://en.wikipedia.org/wiki/Markdown Markdown] to improve their appearance.


# What is the difference between the <tt>fork</tt> and <tt>exec</tt> function in a UNIX environment? ( 1 point )
'''No other formats will be accepted.''' Submitting in another format will likely result in your assignment not being graded and you receiving no marks for this assignmentIn particular do not submit an MS Word or OpenOffice file as your answers document!
# What is a zombie process? ( 1 point )
 
# Give an example C program which creates a zombie processNote that the shell by default will collect and destroy zombie processes and so you will need to avoid the shell destroying the zombie process during debuggingThis can be done by delaying the parent exit (using sleep is one good way to do this). ( 2 points )
Don't forget to include what outside resources you used to complete each of your answers, including other students, man pages, and web resourcesYou do not need to list help from the instructor, TA, or information found in the textbook.
# Perform the modifications to your program above to avoid creating a zombie processList the new program. ( 3 points )
 
# Permissions on Unix are grouped into three basic file operations. What are these file operations? ( 1 point )
# [1] Permissions on UNIX are grouped into three basic file operations. What are these file operations?
# What does it mean to have execute permission on a directory? ( 1 point )
# [1] What does it mean to have execute permission on a directory?
# What are the 6 basic file permissions within Windows? ( 1 point )
# [1] What are the 6 basic file permissions within Windows?
# What is the difference between the write and modify file permission in Windows? ( 1 point )
# [1] What is the difference between the write and modify file permission in Windows?
# Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  What attribute on the directory prevents those who can modify a directory from deleting files (hint: help on the <tt>chmod</tt> command may prove useful). ( 1 point )
# [1] Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in.  Temporary directories such as /tmp have a special "t" permissionWhat is this permission for?
# In Windows, a file can be associated with more than one group and each group can have different access permissionsOn Unix, each file can only belong to one group and groups cannot contain other groups (groups can only contain users).  Having said that, new groups can be created by the system administrator which are supersets of other groups (e.g., to create group C with members of A and B, just add all of A's and B's members to C).  Given this, is it possible to develop an access permission scenario which would be impossible to implement in Unix but possible to implement in Windows? If yes, give an example.  If no, explain why. ( 1 point )
# [1] What does the PATH environment variable do?  PWD?
# What does the PATH environment variable do?  PWD? ( 1 point )
# [1] What environment variable tells X applications where to find the X server which it should communicate with to display the output?
# What environment variable tells X applications where to find the X server which it should communicate with to display the output? ( 1 point )
# [3] To what degree does a modern web browser, such as Firefox or Chrome, look and act like an operating system?  What about a scriptable application such as Microsoft Word?
# Dynamic libraries allow one copy of executable code to be used by many different processes on the system, without requiring that multiple copies of the code be stored on disk in different files. What are some problems that can arise when different programs use the same common DLLs (hint: ``DLL Hell'')? ( 1 point )
 
 
==Solutions==
 
# Read, Write, and Execute
# With execute permission you can access the files in the directory (specifically, gain access to the referenced inodes).  If you have read but no execute permissions you can get a listing of files but you can't access them; if you have execute but not read access you can access specific files but you cannot get a list of them.
# Read, Write, Read & Execute, List Folder Contents, Modify, Full Control
# Write permits only writing to a file, while modify allows the user to read, write, and delete a file.
# The t permission is the "sticky" bit. If it is set for a directory, a file in the directory can be removed or renamed only if the user has write permission for the directory and owns the file or owns the directory.  (The sticky bit originally was used to keep executables in swap so they would load faster; this makes no sense on modern systems so it normally does nothing for regular files.)
# The PATH environment variable lists the directories that are searched for executables when the location of an executable is not specified.  Thus when you type "ls" at the shell prompt, it normally runs /bin/ls because /bin is normally in PATH. PWD is the "present working directory"; the shell updates it with the current directory every time you change directories (e.g., using a cd command).
# DISPLAY
# Operating systems provide platforms for running programs.  The two main responsibilities of operating systems are to manage the resources of the computer and to provide abstractions to make accessing those resources easier for a programmer.  Both web browsers and scriptable applications provide platforms for running programs.  They abstract resources by providing higher-level programming environments (e.g., JavaScript/HTML/CSS, VBA) They also manage resources, even providing ways to control which programs are allowed to run and to terminate the execution of programs running within them.  The key difference between complex, programmable applications and operating systems is that applications must run on an operating system while operating systems only require computer hardware to run.  Thus applications provide provide their OS-like services by building on top of the functionality the underlying operating system provides.

Latest revision as of 15:08, 22 September 2014

Please submit the answers to the following questions via CULearn by midnight on Wednesday, September 10, 2014. There 10 points in 8 questions.

Submit your answers as a single text file named "<username>-comp3000-assign1.txt" (where username is your MyCarletonOne username). The first four lines of this file should be "COMP 3000 Assignment 1", your name, student number, and the date of submission. You may wish to format your answers in Markdown to improve their appearance.

No other formats will be accepted. Submitting in another format will likely result in your assignment not being graded and you receiving no marks for this assignment. In particular do not submit an MS Word or OpenOffice file as your answers document!

Don't forget to include what outside resources you used to complete each of your answers, including other students, man pages, and web resources. You do not need to list help from the instructor, TA, or information found in the textbook.

  1. [1] Permissions on UNIX are grouped into three basic file operations. What are these file operations?
  2. [1] What does it mean to have execute permission on a directory?
  3. [1] What are the 6 basic file permissions within Windows?
  4. [1] What is the difference between the write and modify file permission in Windows?
  5. [1] Because all files are stored in a directory, under UNIX permission to delete, rename, and move files is determined by the users access rights on the directory the file is contained in. Temporary directories such as /tmp have a special "t" permission. What is this permission for?
  6. [1] What does the PATH environment variable do? PWD?
  7. [1] What environment variable tells X applications where to find the X server which it should communicate with to display the output?
  8. [3] To what degree does a modern web browser, such as Firefox or Chrome, look and act like an operating system? What about a scriptable application such as Microsoft Word?


Solutions

  1. Read, Write, and Execute
  2. With execute permission you can access the files in the directory (specifically, gain access to the referenced inodes). If you have read but no execute permissions you can get a listing of files but you can't access them; if you have execute but not read access you can access specific files but you cannot get a list of them.
  3. Read, Write, Read & Execute, List Folder Contents, Modify, Full Control
  4. Write permits only writing to a file, while modify allows the user to read, write, and delete a file.
  5. The t permission is the "sticky" bit. If it is set for a directory, a file in the directory can be removed or renamed only if the user has write permission for the directory and owns the file or owns the directory. (The sticky bit originally was used to keep executables in swap so they would load faster; this makes no sense on modern systems so it normally does nothing for regular files.)
  6. The PATH environment variable lists the directories that are searched for executables when the location of an executable is not specified. Thus when you type "ls" at the shell prompt, it normally runs /bin/ls because /bin is normally in PATH. PWD is the "present working directory"; the shell updates it with the current directory every time you change directories (e.g., using a cd command).
  7. DISPLAY
  8. Operating systems provide platforms for running programs. The two main responsibilities of operating systems are to manage the resources of the computer and to provide abstractions to make accessing those resources easier for a programmer. Both web browsers and scriptable applications provide platforms for running programs. They abstract resources by providing higher-level programming environments (e.g., JavaScript/HTML/CSS, VBA) They also manage resources, even providing ways to control which programs are allowed to run and to terminate the execution of programs running within them. The key difference between complex, programmable applications and operating systems is that applications must run on an operating system while operating systems only require computer hardware to run. Thus applications provide provide their OS-like services by building on top of the functionality the underlying operating system provides.