CMPSC 311 Such Final Very Exam

Similar documents
CMPSC 311 Exam 2. March 27, 2015

CS Operating system Spring Final -- May 8, You have 120 min. Good Luck!

NETWORK PROGRAMMING. Instructor: Junaid Tariq, Lecturer, Department of Computer Science

Assignment 2 Group 5 Simon Gerber Systems Group Dept. Computer Science ETH Zurich - Switzerland

Ports under 1024 are often considered special, and usually require special OS privileges to use.

Question Score 1 / 19 2 / 19 3 / 16 4 / 29 5 / 17 Total / 100

CPS 310 first midterm exam, 2/26/2014

Key Points for the Review

CSE 333 Section 8 - Client-Side Networking

ECE 435 Network Engineering Lecture 2

SYSTEM CALL IMPLEMENTATION. CS124 Operating Systems Fall , Lecture 14

Socket Programming for TCP and UDP

Problem Set: Processes

CSC209 Review. Yeah! We made it!

Problem Set: Processes

CS 370 Operating Systems

Overview. Last Lecture. This Lecture. Daemon processes and advanced I/O functions

A Socket Example. Haris Andrianakis & Angelos Stavrou George Mason University

Design Overview of the FreeBSD Kernel CIS 657

CSE 333 Lecture fork, pthread_create, select

Design Overview of the FreeBSD Kernel. Organization of the Kernel. What Code is Machine Independent?

Inter-process communication (IPC)

UNIVERSITY OF TORONTO SCARBOROUGH Computer and Mathematical Sciences. APRIL 2016 EXAMINATIONS CSCB09H3S Software Tools & Systems Programming

CSE 333 Final Exam June 6, 2017 Sample Solution

Motivation of VPN! Overview! VPN addressing and routing! Two basic techniques for VPN! ! How to guarantee privacy of network traffic?!

CSE 333 Final Exam 3/19/14

UNIX Sockets. Developed for the Azera Group By: Joseph D. Fournier B.Sc.E.E., M.Sc.E.E.

Department of Computer Science Faculty of Engineering, Built Environment & IT University of Pretoria. COS122: Operating Systems

There are 8 total numbered pages, 6 Questions. You have 60 minutes. Budget your time carefully!

W4118 Operating Systems. Junfeng Yang

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files

CSC209: Software tools. Unix files and directories permissions utilities/commands Shell programming quoting wild cards files. Compiler vs.

CSE 333 Final Exam Sample Solution 3/19/14

Lecture 2. Outline. Layering and Protocols. Network Architecture. Layering and Protocols. Layering and Protocols. Chapter 1 - Foundation

Introduction! Overview! Signal-driven I/O for Sockets! Two different UDP servers!

CSE 153 Design of Operating Systems Fall 2018

Overview. Daemon processes and advanced I/O. Source: Chapters 13&14 of Stevens book

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

CS 485/ECE 440/CS 585 Fall 2013 Midterm

Interprocess Communication Mechanisms

shared storage These mechanisms have already been covered. examples: shared virtual memory message based signals

416 Distributed Systems. Networks review; Day 2 of 2 Fate sharing, e2e principle And start of RPC Jan 10, 2018

Lecture 10 Overview!

University of Ottawa School of Information Technology and Engineering

VALLIAMMAI ENGINEERING COLLEGE. SRM Nagar, Kattankulathur QUESTION BANK

Windows architecture. user. mode. Env. subsystems. Executive. Device drivers Kernel. kernel. mode HAL. Hardware. Process B. Process C.

ECE 435 Network Engineering Lecture 2

CMPSC 311- Introduction to Systems Programming Module: Concurrency

CSE 333 Lecture 16 - network programming intro

Lecture 24. Thursday, November 19 CS 375 UNIX System Programming - Lecture 24 1

Getting to know you. Anatomy of a Process. Processes. Of Programs and Processes

St. MARTIN S ENGINEERING COLLEGE Dhulapally,Secunderabad DEPARTMENT OF INFORMATION TECHNOLOGY Academic year

Outline. Option Types. Socket Options SWE 545. Socket Options. Out-of-Band Data. Advanced Socket. Many socket options are Boolean flags

CS 3214 Final Exam. To be considerate to your fellow students, if you leave early, do so with the least amount of noise.

Layers in a UNIX System. Create a new process. Processes in UNIX. fildescriptors streams pipe(2) labinstructions

INSTITUTE OF AERONAUTICAL ENGINEERING (Autonomous) Dundigal, Hyderabad

Final Exam 1 /12 2 /12 3 /10 4 /7 5 /4 6 /10 7 /8 8 /9 9 /8 10 /11 11 /8 12 /10 13 /9 14 /13 15 /10 16 /10 17 /12. Faculty of Computer Science

CS 326: Operating Systems. Networking. Lecture 17

IPv4 and ipv6 INTEROPERABILITY

CSE 333 Midterm Exam Cinco de Mayo, 2017 (May 5) Name UW ID#

Hybrid of client-server and P2P. Pure P2P Architecture. App-layer Protocols. Communicating Processes. Transport Service Requirements

CSC Systems Programming Fall Lecture - XXIII Final Review. Tevfik Koşar. Louisiana State University

Using make. Using Variables in Makefiles. Implicit Rules. Static vs Dynamic Libraries. Libraries. Tevfik Ko!ar

Midterm Exam CPS 210: Operating Systems Spring 2013

Tutorial on Socket Programming

CS 43: Computer Networks. 07: Concurrency and Non-blocking I/O Sep 17, 2018

UNIX Sockets. COS 461 Precept 1

CSI 402 Systems Programming LECTURE 4 FILES AND FILE OPERATIONS

Midterm I of Computer Communication , Winter 2004 Electrical and Computer Engineering Department, University of Windsor

CSci 4061 Introduction to Operating Systems. IPC: Basics, Pipes

Threads (light weight processes) Chester Rebeiro IIT Madras

CMPSC 311- Introduction to Systems Programming Module: Concurrency

Operating System Structure

Cpt S 122 Data Structures. Course Review Midterm Exam # 1

Programming Internet with Socket API. Hui Chen, Ph.D. Dept. of Engineering & Computer Science Virginia State University Petersburg, VA 23806

Group-A Assignment No. 6

Section 3: File I/O, JSON, Generics. Meghan Cowan

CS111: PROGRAMMING LANGUAGE II

CS 3113 Introduction to Operating Systems Midterm October 11, 2018

CS 3113 Introduction to Operating Systems Midterm October 11, 2018

CLIENT-SIDE PROGRAMMING

CPS 310 midterm exam #2, 4/10/2017

SOCKET PROGRAMMING. What is a socket? Using sockets Types (Protocols) Associated functions Styles

Socket Programming. Sungkyunkwan University. Hyunseung Choo Copyright Networking Laboratory

Concurrent Programming

CS 550 Operating Systems Spring Inter Process Communication

CMPSC 311- Introduction to Systems Programming Module: Concurrency

Programming Assignment 1

ECE 2400 Computer Systems Programming, Fall 2018 PA2: List and Vector Data Structures

Process. Heechul Yun. Disclaimer: some slides are adopted from the book authors slides with permission

EECE.4810/EECE.5730: Operating Systems Spring 2017 Homework 2 Solution

Sockets 15H2. Inshik Song

Background: I/O Concurrency

CS631 - Advanced Programming in the UNIX Environment Interprocess Communication II

Network Implementation

CS 3013 Operating Systems WPI, A Term Assigned: Friday, August 31, 2007 Due: Monday, September 17, 2007

The Berkeley Sockets API. Networked Systems Architecture 3 Lecture 4

CS 351 Week 15. Course Review

Programming Assignment 3

Any of the descriptors in the set {1, 4} have an exception condition pending

Transcription:

Section: 2:30 3:35 Name: CMPSC 311 Such Final Very Exam May 5, 2014 Closed book, closed neighbor, no electronic tools or additional papers. You may not share or discuss exam questions with anyone. This material may not be reused, redistributed, or embedded without prior written consent of the author.

1 Short Questions (36pts total, 3pts each, be brief) 1. What is the mode of a file? 2. Fill in the blank in the output of the following code: uint16_t x = 42; uint16_t *p = &x; printf("p is: %p\n", p); p += 3; printf("now p is: %p\n", p); Output: p is: 0xfff800 Now p is: 3. Write a short C implementation of the Unix false command. 4. Name a function used specifically to print a formatted error message after a C library function or system call fails and sets errno? 5. In a distributed version control system, what must be true in order to push revision X to a repository which contains everything up to revision Y? 6. How does a program reap a child process that has become a zombie? 7. What is a file descriptor? 1

8. Each thread in a multi-threaded process has its own copy of which memory segment or segments (code, data, heap, stack)? 9. When the operating system receives an incoming TCP or UDP packet, how does it know which socket it should be delivered to? 10. What function is used to disconnect a socket? 11. What is the difference between the following two code snippets? lseek(fd, 100, SEEK_SET); read(fd, buf, 4); pread(fd, buf, 4, 100); 12. What specific protocol/system does the gethostbyname function use? 2 Medium Questions (34pts total) 13. (5pts) The following function has a problem. Write a fixed version. int *give_me_twenty(int x) { int array[20]; int i; for (i = 0; i < 20; i++) array[i] = x; return array; } 2

14. (5pts) What does the following statement do? Be specific. int (*foo)(double *); 15. (6pts) Write two function calls that open the file hello.txt for reading only: one using stream I/O, and the other using low-level file descriptor I/O. Be sure to store the return values in a variable of the appropriate type. 16. (6pts) Name one advantage of: (a) a sequential server over a forking server (b) a forking server over a threaded server (c) a threaded server over a forking server 3

17. (6pts) Name the following six version control operations: (a) Create a new revision in the repository: (b) Make a copy of an entire repository, including all revisions: (c) Copy revisions from a local repository to a remote one: (d) Copy revisions from a remote repository to a local one: (e) Copy a revision from the repository to the working copy: (f) Create a new revision that includes two or more branches: 18. (6pts) Below is a struct that represents a network header. Fill out the header_to_hbo function that converts the values in the header from network byte order to host byte order. struct header { uint32_t sourceid, destid; uint16_t port; uint8_t ttl, flags; }; void header_to_hbo(struct header *h) { } 4

3 Long Questions (30pts total, 10pts each) 19. Reading questions: (a) What is the first argument to the sprintf function in C? (b) What does the alarm function do? (c) Write a C snippet that tells the program to ignore the SIGINT signal. 20. Convert the following description into a C abstract data type using the techniques described in class: A shoe is a type of accessory. (Note: you may assume that there is already an ADT called accessory.) Every shoe has a particular size. When I initialize a new shoe, I should be able to specify the size. Given a shoe, I should be able to get its size. 5

21. Name four functions we covered in lecture which operate specifically on sockets (NOT on other types of files), and identify what each one does. Be sure to mention whether it is used on the client side, the server side, or both. 4 Bonus As specifically as possible, name beverages consumed by the instructor during class. All of them have actually been identified aloud by name during the semester. One point for a correct answer, but an incorrect guess will cancel out a correct one. 6