60 likes | 253 Views
CS311 – Lecture 25 Outline. Discussion on Project 5. Summary of Interprocess Communication Mechanisms Review of CS311 Learning Objectives Note: These lecture notes are not intended replace your notes. This is what I expect your notes to already look like, but with more explanation as needed.
E N D
CS311 – Lecture 25 Outline Discussion on Project 5. Summary of Interprocess Communication Mechanisms Review of CS311 Learning Objectives Note: These lecture notes are not intended replace your notes. This is what I expect your notes to already look like, but with more explanation as needed. CS311 – Operating Systems 1 1
Discussion on Project 5 How to get input from users: fgets(), getline() Removing newline character from user input: http://classes.engr.oregonstate.edu/eecs/summer2009/cs311/node/179 Common problems in project 5: http://classes.engr.oregonstate.edu/eecs/summer2009/cs311/node/180 CS311 – Operating Systems 1 2
fgets() • An input function (file get string) char* fgets(char *string, int length, FILE *stream) • fgets reads a string of specific length from a file (or standard input) pointed to by stream. • fgets terminates reading: • after a new-line character (\n) is found, OR • after it reaches end-of-file (EOF), OR • after (length - 1) characters have been read • Fgets stores a '\0‘ after the last character in the buffer. CS311 – Operating Systems 1
getline() ssize_t getline (char **lineptr, size_t *n, FILE *stream) This function reads an entire line from stream, storing the text (including the newline and a terminating null character) in a buffer and storing the buffer address in *lineptr. Before calling getline, you should place in *lineptr the address of a buffer *n bytes long, allocated with malloc. When successful, it returns the number of characters read (including the newline, but not including the terminating null). Otherwise, it returns -1. CS311 – Operating Systems 1
IPC Summary CS311 – Operating Systems 1
CS311 Learning Objectives Explain why multiprogramming is important for modern operating systems. Explain the general structure of a multiprogrammed operating system. Explain the purpose and operation of system calls. Write a program utilizing system calls. Write a program using a scripting language. Write a program that uses regular expressions to parse input data. Explain how a common file system works, including structure, I/O operations, and security. Describe the memory organization of a typical process in a common operating system. Write a program that spawns processes and provides mutual exclusion for variables or other resources shared by the processes. Write a program that uses sockets to implement a client/server system. CS311 – Operating Systems 1 6