Laboratory 1
Laboratory 1 Notes »Subjects
- Evaluation, Introduction
- Bash commands
- Working with files in C
Laboratory Assignments
- Get from /etc/passwd all usernames that end in 'x' or 'z'. Redirect the output to output.txt file.
- (BONUS) Using output.txt we want to write at the beging of the file the following "Am gasit utilizatorii:". In output.txt we have usernames that respect the following format 'firstname.lastname'. We want to change the 'lastname' of the user on the 4th row with the following: "mylastname".
References
- List of Linux Commands
- An Introduction to GCC Book Online Version
- GCC online documentation
- Working with files Stream properties, indicators, functions, macros
Contact
E-mail: stefan.negru at infoiasi.ro
Please use the following Subject field format of your emails concerning this laboratory: [CN] Message Title
Evaluation
The final grade is calculated using the following formula:
N = 0.3 * P + 0.4 * T + 0.2 * L + 1.
Where:
- P – Mandatory Project to be delivered during weeks 13, 14, 15 or 16 (30% of the final grade); - more details »
- T – Mandatory Test taken during week 16 (graded 1 to 10). The test will include course and laboratory subjects (40% of the final grade);
- L – student's involvement during the laboratory, plus contribution and/or participation to the CN-related events – e.g., workshops, conferences, contests, other major public projects (20% of the final grade).
Important
In order to pass, each student must obtain minimum 5 points for P and T components.
More Details »Laboratory 2
Laboratory 2 Notes »Subjects
- Process Management
- Inter-process Communication
- Signals
Laboratory Assignments
- Compile,execute and explain the examples on the Course 2 Webpage
- Create a program that will run in the background, and from 3 in 3 seconds will write a random number in a file. Details of implementation: the parent process will wait SIGUSR1 signal appearance, then it will create a child process, this will be the one that it will write in the file, the parent will wait for child process execution, at which point a message will be displayed.
References
- Interprocess Communication Mechanisms
- About Interprocess Communication
- Interprocess Communication and Signals
- List of available signals
- All about Linux signals
- Linux Signals for the Application Programmer
- The Linux Programming Interface Book
Laboratory 3
Mandatory Assignment - due until Laboratory 4 Laboratory 3 Notes »Subjects
- Inter-process Communication
- Descriptors duplication
- Pipes, FIFOs
Laboratory Assignments
- Compile,execute and explain the examples on the Course 3 Webpage
- Write a program that uses a single pipe for communication and in which:
- parent process writes a number in the pipe (read from the keyboard)
- child process checks if the number is prime and transmits the parent process the response (yes/no)
- parent process will display the response
- Write a program to simulate the command: cat / etc / passwd | grep "account name"> account.txt, using FIFO's and duplications. Account name will read from the keyboard.
- (BONUS) Implement a program to determine the maximum capacity of a pipe.
References
- Duplicating Descriptors
- Inter-process Communication part I Pipes, FIFOs
- Introduction to Named Pipes
- Working with Pipes in C
- Using Pipes in Linux Processes
Laboratory 4
Laboratory 4 Notes »Laboratory Assignments
- Compile,execute and understand the example soketpair.c on the Course 4 Webpage
- Create a program in which a father process divides an arithmetic expression in a number of subexpressions. These subexpressions are each evaluated by a child process. The result is returned to the parent process, which will review the expression and return the final result. Communication will be implemented using socketpair().
Mandatory Assignment Evaluation
Implement the following inter-process communication protocol:- the communication is done in the parent process and executed by the child process;
- the commands are givin as strings delimited by "new line";
- the answers are byte strings prefixed by the response length;
- the protocol includes the commands:
- login: username (validating the username by using the /etc/passwd file)
- cd path
- ls
- quit
- the inter-process communication will be implemented using one of the known communication mechanism.
Important
Assignment is due Laboratory 4.
Lecture Notes - Course 4 »Laboratory 5
Project Technical Report - due until Laboratory 7 Laboratory 5 Notes »Subjects
- Sockets
- TCP client/server
Laboratory Assignments
- Compile,execute and understand the example on the Course 5 Webpage
- (BONUS) Modify the example above such that the clients will be processed concurrently using fork(). Watch out for zombie processes.
- Develop a TCP server which upon receiving a number from a client, will return the incremented number to the client along with the client number.
- Considering a configuration file using the following: (key:command):(e.g. 1111: /bin/ls: 2222: /bin/pwd: 3333:/bin.ps:). Develop a TCP server which will execute the command associate with a known key recieved from a client, anything else will return "Unknown key".
References
- Sockets Tutorial
- Client Server Model Architecture
- About socketpair
- Sockets Server and Client.
- Learning UNIX. Part 3: System Calls, Sockets and IPC/2
Technical Report
Each chosen project must have a technical report associated with it. Until Laboratory 7 you must complete the following:
- description of used technologies (learned so far at the Course) - depending on the project's implementation details; - This section will be completed as new technologies are being taught at the Course.
- architectural and flow overview together with a survey of the concepts involved (provide details of how certain parts of your project work, interconnect each other and an analytical overview of the project; provide graphical diagrams);
- partial implementation details (examples of portions source code used);
- More details about Project Evaluation and Requirements.
Laboratory 6
Laboratory 6 Notes »Subjects
- Concurrent TCP client/server
Laboratory Assignments
- Considering a configuration file using the following: (key:command):(e.g. 1111: /bin/ls: 2222: /bin/pwd: 3333:/bin.ps:).
- Develop a concurrent TCP server which will execute the command associate with a known key recieved from a client, anything else will return "Unknown key".
- The client will display the result of the given command.
- The server will keep a history of the keys recieved from a client and will have a key associated with the history commad.
- Adapt the mandatory assignment from Laboratory 4, so that the communication is done in a concurrent manner between a server and a number of clients.
References
- Beej's Guide to Network Programming options for a socket;
- Implementation of a Concurrent Server Using fork() (.doc file)
- The GNU C Library Process Completion waitpid()
- About waitpid() options
- Using SO_REUSEADDR.
Laboratory 7
Laboratory 7 Notes »Laboratory Assignments
- Compile,execute and understand the example on the Course 7 Webpage
- Consider de exercises from Laboratory 5 and develop a UDP server/client instead of a TCP server/client.
Mandatory Assignment Evaluation - Technical Report
Each chosen project must have a technical report associated with it. Until Laboratory 7 you must complete the following:
- description of used technologies (learned so far at the Course) - depending on the project's implementation details; - This section will be completed as new technologies are being taught at the Course.
- architectural and flow overview together with a survey of the concepts involved (provide details of how certain parts of your project work, interconnect each other and an analytical overview of the project; provide graphical diagrams);
- partial implementation details (examples of portions source code used);
- More details about Project Evaluation and Requirements.
Technical Report recommended format - Springer LNCS
Important
Assignment is due Laboratory 7.
Lecture Notes - Course 7 »Laboratory 8
Midterm - Project Work
Work on the project. Follow the guidelines:
- the projects are individual;
- the projects will be released under GNU GPL (General Public License);
- the projects will be graded depending on the difficulty:
- (A) advanced - maxim 10 points;
- (B) medium - maxim 8 points;
- (C) easy - maxim 6 points;
- exceptional contributions will be graded additional 2 points;
- mandatory project can be delivered during weeks 13, 14, 15;
- during week 16 only A type projects, can be presented;
- the project will have an attached documentation;
- More details about Project Evaluation and Requirements.
Laboratory 9
Project Work.
Work on the project. Projects List »
Review Resurse Web in Romanian.
The Laboratory will be held during week 10 as 1st December is Romania National Day.
Lecture Notes - Course 9 »
Laboratory 10
Laboratory 9 Notes »Subjects
- Synchronous Multiplexing I/O (Input/Output)
- select()
Laboratory Assignments
- Develop a program which will wait 6 seconds and 45 microseconds for the user to write something from the keyboard.
- Develop a minichat which will use select() for handling sockets and descriptors.(hint: the server will use select to handle clients)
- (2*BONUS) Solve the bug from the example provided in Course 9 Webpage. The bug appears when we connect the client to the server and no input is provided, and instead "CTRL + C" is pressed.
References
- select() Documentation
- select() Documentation 2
- Programming GuideInput/Output Multiplexing
- More Details aboutInput/Output Multiplexing
Laboratory 11
Laboratory 10 Notes » and Laboratory 11 Notes »Subjects
- Out-Of-Band;
- gethostbyname() | getaddrinfo(); gethostbyaddr() | getnameinfo().
Laboratory Assignments
- Using the minichat developed during Laboratory 10, develop a mechanism for handling OOB data by considering the following:
- a client with administrator rights and can notify the server to send to another client (which does not have administrator rights) an OOB byte;
- when the client(the one that does not have administrator rights) recieves the OOB byte it will disconnet from the server.
- Verify if the ports 8011 and 6089 are open on www.uaic.ro or www.emag.ro. Find the IP address of the websites using getaddrinfo().
References
- Using Out-of-Band Data
- Out-of-Band Data documentation 1
- Out-of-band data documentation 2
- Out-of-band data IBM documentation
- gethostbyname and gethostbyaddr functions
- getaddrinfo function
- getnameinfo function
Laboratory 12
Recuperare Laborator 12
Laboratoarele din saptamana 12 ( 22 Decembrie 2011 ) se vor recupera vineri 16 Decembrie 2011 dupa cum urmeaza:
- Grupa B6 - C403 - orele 1000 - 1200;
- Grupa B7 - C409 - orele 1200 - 1400;
- Grupa A7 - C409 - orele 1400 - 1600.
Referatele vor fi predate pana pe 22 Decembrie 2011 (ora 2300) prin e-mail la adresa: stefan.negru at infoiasi.ro in format electronic. In saptamana 13 (12 Ianuarie 2012) vor fi predate in format printat.
Subjects
- Threads
Laboratory Assignments
- Considering a configuration file using the following: (key:command):(e.g. 1111: /bin/ls: 2222: /bin/pwd: 3333:/bin.ps:).
- Develop a concurrent TCP server that makes use of threads which will execute the command associate with a known key recieved from a client, anything else will return "Unknown key".
- The client will display the result of the given command.
- The server will keep a history of the keys recieved from a client and will have a key associated with the history commad.
- (2*BONUS)Consider a producer/consumer scenario:
- The producer generates numbers from 1 to 10 in a random interval (between 0 and 100 milisec.) and stores them in a var.
- Each consumer will read the numbers from the producer and display them on the screen.
References
- POSIX thread (pthread) libraries
- pthreads function
- Introducere in firele de executie POSIX .pdf file
- Fire de executie in Linux - tutorial
- Multithreaded Programming Guide .pdf file
Laboratory 13
Prezentari Referate
Referatele vor fi predate pana pe 22 Decembrie 2011 (ora 2300) prin e-mail la adresa: stefan.negru at infoiasi.ro in format electronic. In saptamana 13 (12 Ianuarie 2012) vor fi predate in format printat.
Project Presentations.
Work on the project. Projects List »
Papers (referate) presentations.
Lecture Notes - Course 13 »
Laboratory 14
Project Presentations.
Work on the project. Projects List »
Lecture Notes - Course 14 »
Laboratory 15
Project Presentations.
Work on the project. Projects List »
Lecture Notes - Course 15 »
Laboratory 16
Project Presentations. (only A type projects)
Laboratory Project Evaluation
Evaluarea proiectelor de laborator din saptamana 16 va avea loc la data de 30.01.2012 intre orele:
- 0830 -1130C401
Vor fi evaluate doar proiectele de clasa A.
Laboratory Project Re-evaluation
Re-evaluarea proiectelor de laborator va avea loc la data de 13.02.2012 intre orele:
- 0800 -1100C401
Va fi o penalizare de 1,5 puncte.
Proiectele de categorie C care aduc un plus de functionalitatea fata de cerinta initiala, vor fi luate spre evaluare.
Written Test
Testul Scris 30.01.2012
- 1200 -1400anul II A
- 1400 -1600anul II B
- Locatie: C2, C112, C309
Written Test Re-evaluation
Testul Scris Restanta 13 Februarie 2012 Ora 1100, Locatie:C2, C112, C309
Obs. Salile se mai pot modifica in functie de disponibilitate. Modificarile vor fi anuntate pe pagina cursului.