OS
Operating
Systems
and
Real
Time
Operating
Systems

General information


Labs

General information on labs

During a laboratory session, you are not supposed to surf on the Internet, except for searching some information relevant to this laboratory session. Also, you are not supposed to read your email, chat, and send SMS or whatever. Do not work in groups, not even in groups of two. You will get a much better understanding and get the maximum benefit of the lab if working alone. While far less difficult, sitting near a geek and admiring how fast she/he is will not be as beneficial. Of course, You can exchange ideas with somebody else during the lab, but lab reports are individual, personal work. After you have tried hard on a question, you can obvisouly seek for help by calling the teaching assistants. Also, sometimes, a partial solution is given with a
(Help me!) This will give you a partial help
.

The very basics of Software development

  • Editing a C file
Start a terminal. When you want to edit a file, just start a text editor such as vi, vim, emacs or xemacs. If you are not familair with these editors, you may also use kwrite, but it is not as powerful.
$ emacs myfile.c
You may also use your favorite text editor.

  • Compiling a C file
For software projects with several source files, it is common to use a Makefile to generate an executable file. If no Makefile is provided, you will just need to compile one file at a time as follows:
$ gcc -o myExe myFile.c
with myExe, the name you want to give to the executable file, and myFile.c, the name of the C file you want to compile.

Compilation may fail: in most cases, it is due to an error in your program.

Sometimes, when using perticular programming libraries, you need to specify additional compilation directives. For example, when using POSIX features, you need to specify the real-time library:
$ gcc -lrt -o myExe myFile.c
Executing your program
$ myExe

F.A.Q.

  • I am stuck with programming, what should I do?
Always think about manual pages first. They contain a lot of information regarding all the functions you use. For example:
$ man fork
And to specify a given section (here, section 2) of manual pages:
$ man -S 2 clone
Another way to do is to use the apropos command:
$ apropos clone
Also, you can find information on the course's slides or on Linux manual pages on the Internet.

  • When I compile, I get error messages, what should I do?
Error messages generated by compilers are often not easy to understand. Make your best! Also, you have to remember to always deal with error messages in the order given by the compiler: always start by the first error message. And if you have a doubt about the second error message, recompile before dealing with it.