CSE-381: Systems 2 Study Guide for Final Exam
Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit
Study Guide for Final Exam
CSE-381: Systems 2
Text coverage:
E-book titled “Operating System Concepts" -- Link in Syllabus page on Canvas (all students have free access to the electronic book):
§ Chapter 3: Processes (Fork & Exec)
i. Chapter 3.4, 3.5: Inter-Process Communication (IPC)
§ Chapter 4: Threads
§ Chapter 6: Synchronization
§ Virtualization & Cloud Computing (multiple-choice questions only)
§ C++ programming (1-or-2 programming question)
§ Linux commands & bash-shell piping (short answer /multiple-choice)
1. Basics of processes
i. Concept of processes. Process vs. program
ii. Basic memory layout of processes (Text, Data, Heap, & Stack)
iii. Observing processes using ps and top
iv. Processes hierarchies and tracing hierarchies in Linux
v. Terminating processes using kill
vi. Process lifecycle: New®Ready®Running®Waiting®Terminating
a. Scenarios when different transitions occur
2. Process creation
i. Creating processes using fork system call
1. Creating different hierarchies of processes
2. Understanding cloning of I/O streams
ii. Replacing existing program with execvp system call
1. Review execl and execvp system calls
2. Passing command-line arguments
3. Basic idea of PATH to locate programs
iii. Using waitpid to wait for process to complete
1. Using exit code (return value for main of child process)
3. Basics of Managing threads in Linux
i. Basics of process & thread management and process hierarchies.
ii. Viewing threads in Linux using ps -fealL
iii. Starting and killing threads via Linux terminal.
iv. Setting thread priorities and nice values.
v. Process IDs, Parent process IDs, and Monitoring processes using ps command.
4. Basics of Linux operations
i. Creating and navigating directories via Linux terminal.
ii. Creating, copying, and deleting files using commands in a Linux terminal.
iii. Basics of compiling and running C/C++ program in Linux in a Linux terminal.
iv. Foreground vs. background processes in Linux.
5. Threads and multithreading (topic of emphasis for programming questions)
i. Concurrency and multi-tasking.
ii. Concept of multithreading.
iii. Concept of a thread. Single vs. multi-threaded processes.
iv. Resources shared between threads versus resources available only to a thread.
v. Processes vs. Threads --advantages vs. disadvantages.
vi. Thread lifecycle (same as process life cycle): New®Ready®Running®Waiting®Terminated
vii. Creating threads in C++
a. 2-loops patterns: Programming pattern of using 2-separate loops, 1 loop to start threads and another separate loop to join threads.
viii. Developing synchronization-free multithreaded programs in C++
a. Data parallel program -- several items per thread.
ix. Using /usr/bin/time to measure runtime characteristics of programs
a. Elapsed time, %CPU x. Interpreting output of /usr/bin/time for single vs. multithreaded programs
6. Synchronization (topic of emphasis for programming questions)
i. Race conditions -- identifying and demonstrating race conditions
ii. Identification of code snippets with race conditions / incorrect multi-threading.
iii. Symptoms of race conditions.
iv. Need for synchronization.
v. Concept of a critical section.
vi. 4 Rules to create critical sections.
vii. Concept of a Semaphore and mutex
viii. Using std::mutex to create a critical section
ix. Need and use of a std::lock_guard with std::mutex
x. Identification of critical sections in a code fragment.
xi. Dining philosophers’ conceptual model for multiple, shared resources
xii. Concept of deadlocks
a. Locking multiple mutexes using std::lock to avoid deadlocks
xiii. Producer-consumer multithreading model with fixed size shared queue.
a. Busy-wait/spin-lock approach -- advantages vs. disadvantages
xiv. Using Monitors (or condition variables) to avoid busy waiting (no programming)
a. Using std::condition_variable
b. Understanding wait-notify
c. Advantages vs. disadvantages over busy-wait
7. Virtualization (multiple choice questions only)
i. Virtual Machines and 3 use cases
a. Server virtualization
b. Desktop virtualization
c. Security
ii. Hypervisors
a. Type 1 Hypervisor
b. Type 2 Hypervisor. What is qemu?
iii. Concept of cloud computing
a. Infrastructure as a Service (IaaS)
b. Platform as a Service (PaaS)
c. Software as a Service (SaaS)
8. Networking -- Concepts related to WWW and HTTP
i. Terminology and acronyms
ii. Concept of a protocol
iii. Basics of HTTP protocol and line endings "\r\n"
iv. Basic structure of GET requests
a. URL encoding & decoding
v. HTTP headers
a. HTTP response headers
b. Basic content types in HTTP response
c. Concept of MIME type in HTTP response
vi. Basics of system integration via fork & exec
vii. Identifying parameters from an HTML form
C/C++ programming concepts:
9. Basic program constructs
i. Stages in compiling a C++ program.
ii. Variables & expressions
iii. Constant variables vs. literal constants
iv. Signed vs. unsigned data types
v. if and if-else statements
vi. switch statement
vii. Looping constructs (for, while, do-while, range-for)
viii. Basic mathematical problem solving concepts
§ Deciding number is even/odd, positive/negative, factor/divisor/dividend/quotient
§ Using division and modulo operations for basic number manipulation, e.g.: reverse a number with loops & math (without using string)
§ Detecting if a number is prime.
§ Identifying largest/smallest number in a set of inputs
§ Finding average (i.e., mean) of a given set of numbers
ix. Functions/methods
1. Pass by value versus pass by reference
a. Preferred approach for primitive data types vs. objects
2. Memory/copy impact of pass-by-value
3. Using const keyword for parameters.
x. Default values for parameters
10. Basics of objects
i. Differences between primitive and object data types in C++
ii. Calling methods on objects (e.g.: string::length)
iii. Using std::string
• Constructors for string.
• String comparisons
• Methods for operating and accessing strings
• Conversion to-and-from numeric data types to std::string.
• Formatting strings into HTML, given HTML tags to use (you don't need to know HTML)
11. Arrays
i. Basics of old-style arrays.
ii. 1-D arrays
iii. 2-D arrays
iv. Command-line arguments
• Designing programs that use command-line arguments
• Figuring out what and how many command-line arguments a program ought to take.
• When to prefer command-line arguments instead of reading data from files/console.
12. Basics of Pointers (topic that can be ignored for exam but most important for rest of your careers)
i. Concept of memory and address
ii. Basics of pointers to hold addresses
iii. Basic pointer operators
• Address of operator (&)
• Indirections/dereferencing a pointer (*)
• Using object dereference operator (->)
iv. Pointer arithmetic
v. Pointers « array operation similarities and code conversion
vi. Understanding command-line arguments
• Arrays of pointers
vii. Using shared_ptr in lieu of pointers
13. Vectors (important to know)
i. Use of vectors instead of arrays for processing data
ii. Differences between vectors and arrays
iii. Defining and using vectors of different data types
iv. Using vectors in method definitions and method calls
v. Create type aliases via the using clause in C++
1. Creating aliases given English description
2. Tracing aliases back to their original types.
vi. Operations on a vector: adding elements, accessing elements, removing elements, etc.
vii. Reading/printing/writing vectors to I/O streams
viii. Vectors of user-defined classes
14. Hash maps (unordered_map) (important to know)
i. Concept of unordered_map
ii. Using unordered_map as associative arrays
iii. Defining and using unordered_maps of different data types
iv. Looking-up values in unordered_maps
v. Iterating over all the entries in a map and processing them
vi. Reading/printing/writing vectors to I/O streams
vii. Maps of user-defined classes
15. Basic text file I/O operations
i. Reading and writing data to console using std::cin and std::cout.
ii. Using stream-insertion (<<) and stream-extraction (>>) operators to read and write data.
1. Understanding these operators and how they handle whitespaces.
iii. Using std::getline method to read a full line of text
iv. Using std::ifstream and std::ofstream to read/write text files.
v. Using std::istringstream and std::ostringstream to perform I/O with strings.
16. Other exercises
i. Converting English statements to corresponding C++ statements
ii. Describing C++ statements in English
iii. Code walkthroughs to determine operation and output from a C++ program
iv. Developing a C++ program given a functional description
v. Identifying performance or memory issues in C++ programs
vi. Rewriting C++ program to address memory or performance issue
17. Linux commands and shell
i. Basic operations at the shell prompt
• Navigating directory structures
• Listing files
• Troubleshooting common problems given error message(s)
ii. Compiling and running programs
iii. Using pipes to create ad hoc software pipelines
• Redirection to create (>) or append (>>) to existing files
• Redirection to supply input from a file (<)
• Using pipe (|) to create software pipelines
Preparation Suggestions:
1. As a general note you should expect to repeat questions from lab exercises and homework.
2. You should know all the material in lecture slides.
3. Do read the E-book materials used in homework while paying attention to implementation/application details.
4. Redo lab exercises. Develop short programs to test/verify your understanding of concepts. Review developing classes and overloading operators. Review how to call overloaded operators. Review vectors, how to use vectors. Review unordered_map and how to use it.
5. Review homework solutions on Canvas.
6. Review the functionality of pertinent methods and commands in the supplied method/command sheet.
7. Review the handouts material and videos on Canvas.
2022-08-05