Testing makes sure the OS works as expected.
Debugging helps us find and fix problems.
Imagine building a car without testing it.
Would you feel safe driving it? Probably not.
It’s the same with an OS. It must be tested before people use it.
Testing helps find errors early.
This saves time and prevents system crashes.
🛠️ Example: You write code for memory management. If there is a bug, the system might crash or leak memory. Testing can catch this before release.
Test small parts of the OS code one by one.
Example: Test just the file open function, not the whole file system.
Test how different parts work together.
Example: Check how the file system and memory manager interact.
Test the full OS like a real user would.
Check file reading, process creation, memory allocation, etc.
Make sure that fixing one bug didn’t break something else.
This is very useful when code changes often.
Run the OS under heavy load.
Example: Start many processes, open many files, and see if the OS can handle it.
🧪 Tip: Testing must cover both normal and strange situations.
Debugging means finding and fixing errors (bugs).
Bugs can be tricky. Some crash the system. Others just cause strange behavior.
🔦 You turn on a lamp. Nothing happens. You check the bulb, the switch, and the plug. This is debugging!
printf
but for the kernel. Shows messages on screen or in logs.
🧰 Example: You write a new system call. It doesn’t work. Use printk
to check if your
code runs.
gdb
and printk
.Try writing a simple kernel module that logs "Hello, OS!" using printk
.
Use dmesg
to read the log messages.
Great job! Now you know how to test and debug your OS projects. 🧩