BasicOS
Basics
of
Operating
Systems

General information

Sessions

General information on sessions

During an OS 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: stay focused on the session. 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 labs are individual, personal work. After you have tried hard on a question, you can obviously seek for help calling the teaching assistants. Also, sometimes, a partial solution is given with a
(Help me!) This will give you a partial help
.

Use of AI

Learning curve

Learning operating systems and programming in C is both challenging and rewarding. These topics give you a deeper understanding of how computers really work behind the scenes: memory management, processes, scheduling, filesystems, and low-level programming. Mastering them will sharpen your thinking, improve your debugging skills, and make you a much stronger developer.

AI assistants can be very helpful for daily and professional tasks. But there's a real risk: if you rely too much on AI to write or debug your code, you may feel like you're learning - when in fact you're skipping the essential struggle of solving problems yourself. That frustration when your program segfaults, and the effort you spend to track down why, is not wasted time. It is exactly how you build deep understanding.

If AI gives you answers too quickly, your learning curve becomes shallow: you might pass a lab, but later you'll discover you can't tackle harder problems - especially those that AI cannot solve for you.

How to use AI

Here are a few suggestions:
  • Ask it to explain an error message, or to walk you through a concept of the lectures step by step, but try solving the problem yourself first.

  • After AI gives you a feedback, understand it and totally rewrite it in your own style

  • Always double-check AI output - especially in C, where small mistakes (like wrong use of malloc() or free() calls or incorrect pointer arithmetic) can have big consequences. Never execute a (C) code provided by AI before double-checking it: imagine that a wrong code may erase all your files!

  • Struggle before you ask! If you've thought hard and tried to debug for 30 minutes, then it's fair to use AI as a guide. But don't make it your first instinct in labs.


The very basics of Software development


  • Using terminals
Software development is usually done using terminals to interact with your computer: manipulating files, executing commands, etc. To be more at ease with terminals, I do suggest to follow the tutorial on The Linux command line for beginners


  • Editing a C file
Start a terminal. When you want to edit a file, just start a text editor such as vi, vim, emacs, gedit, visual studio code.
$ code 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.