CS252: Systems Programming Ninghui Li Final Exam Review.

21
CS252: Systems Programming Ninghui Li Final Exam Review

Transcript of CS252: Systems Programming Ninghui Li Final Exam Review.

CS252: Systems Programming

Ninghui Li

Final Exam Review

Topic 1

Understand pointer usage and arithmetic&, *(p+i)

Understand argument passing behavior (especially those involving pointers)2d Array implementationUsing function pointers in generic functions that deal with data of different types

Topic 2

Static vs. shared libraryProgram sections: text, stack, heap, data, especially in the context of software security

Topic 3: Unix Systems Overview

Hard link vs soft linkProcesses, setuid, how effective/real/saved uid changes

Topic 4: Regular Expressions

Understand what kind of strings are matched by a regular expression

Able to write a regular expression to match certain sets of strings

Topic 5: Unix Tools

Know the basic functionality of the UNIX commands in the slidesShell programming not required for final exam.

Topic 6: Flex/Bison

Nothing in particular required for final exam

Topic 7: Project 3Write grammar for YACC.

What is an open file object? What information does it include?What is the semantics for pipe, dup, dup2, especially how they affect the creation/deletion and reference count of open file object?How to implement pipe and redirection using pipe, dup, dup2?

Topic 8: Kernel Mode, System Calls, etc.

User mode vs kernel mode

Poling (synchronous) vs asynchronous

Topic 9: Processes and Scheduling

What are non-preemptive scheduling and preemptive scheduling? What are the pros & cons of each? Which one is used in modern OS?

How does the round robin scheduling work? How response time and overhead are affected by

quantum length? What are factors for choosing quantum length?

Response time, overhead, CPU burst distribution

Topic 10: Threads

Why one wants to use multiple threads?What are the pros and cons of using threads vs. processes?What is an atomic section? Why does disabling interrupt ensure atomicity on a single CPU machine?What is a mutex lock? What is the semantics of lock and unlock calls on a mutex lock?How to use mutex locks to achieve atomicity?

Topic 11

How to implement recursive mutex locks (part of Project 4)?

What is a race condition? (When given simple codes, should be able to come up with race condition scenario.)

What happens when calling sem_wait(), sem_post? (Should be able to produce pseudo-code.)

Different usage of semaphore when initiating it with different values.

What are the key difference between binary semaphore and mutex lock?

How to implement a synchronized list? Why we need both mutex and semaphore?

Topic 12

What are Condition Variables? What is the behavior of wait/signal on CV?

How to implement semaphores using using CV and Mutex?

How to implement bounded buffer using semaphores?

What is a deadlock?

How to prevent deadlocks by enforcing a global ordering of locks? Why this prevents deadlocks?

Topic 12

What are read/write locks? What is the behavior of read/write lock/unlock?

How to implement R/W locks using semaphore?

Why the implementation given in the slides can cause writer starvation?

How to Implement a read/write lock where writer is preferred (i.e., when a writer is waiting, no reader can gain read lock and must wait until all writers are finished)?

Topic 13, 14

Nothing required for final exam

Topic 15

Packet switching networking

Layered architecture (application, transport, network, link)

Addresses & translation services

MAC, IP, Domain names

ARP and DNS

Additional services of UDP over IP: port number

Additional services of TCP over IP: port number

Reliable (achieved using acknowledgement and retransmission), connection-oriented communication

Topic 16: Socket Programming

Server calls: socket, bind, listen, and accept

Behavior of accept, returns a new socket

Client calls: socket, connect

Topic 17: Project 5

Implementing five types of server concurrency

Iterative Server

Fork Process After Request

Create New Thread After Request

Pool of Threads

Pool of Processes

Topic 18: SQL

Writing basic SQL SELECT queries

SELECT … FROM … WHERE

Joining tables when needed

Using tuple variables when needed

No need for DISTINCT, ORDER BY

Give query result when given query and tables

INSERT, DELETE not covered in exam

Topic 19: Software Security

Able to identify the following vulnerabilities in code, and necessary inputs to exploit them

Input validation, buffer overflow, format string, integer overflow

Understand stack overflow exploit that overwrite return address to point to injected shell code, and return-to-libc attacks

Understand basic idea and limitation of non-executable stack

Topic 20: Computer Security Basics

Understand basic security goals: confidentiality, integrity, availability