Learning Systems Programming in C

  • Thread starter Thread starter Mathematicize
  • Start date Start date
  • Tags Tags
    Programming Systems
AI Thread Summary
The discussion centers on self-learning strategies for Systems Programming, particularly in C and UNIX, due to dissatisfaction with the current course instruction. Recommendations include engaging in hands-on projects, such as programming microcontrollers or creating simple operating systems, to gain practical experience. Participants suggest using a debugging kernel for tasks like writing device drivers and emphasize the fun of microcontroller programming. For IDE recommendations, MPLABX is mentioned as a suitable option for beginners. Additionally, the book "UNIX Programming" by Kernighan & Ritchie is recommended for its insights into OS theory, although it may not focus heavily on practical coding. Overall, the conversation highlights the importance of practical projects and resources in mastering Systems Programming independently.
Mathematicize
Messages
11
Reaction score
0
Hey everyone,

I am currently in a C and UNIX Systems Programming course, and my professor is not the best to say the least. Does anybody have recommendations on how to learn Systems Programming on your own? Such as, any interesting projects I could do in my spare time with online resources? Or just any general tips? I am kind of a scatter-brained person, great at math and high-level OOP (java and C#). Also, could anybody recommend me a great IDE with a debugger. I have tried XCode for C, but compared to netbeans and visual studio for java and C#, it does not compare in my opinion.

Thanks!
 
Technology news on Phys.org
I'm not sure what your course involves. Since the unix system is already up and running, it would seem that systems programming would involve something like writing a device driver. Usually a debugging kernel is used for this type of work, does the course include access to a debugging kernel?
 
Personally, programming a microcontroller these days is a lot of fun. There are tons of nice free tools out there, and you get some kind of feeling how it is to write an OS from scratch.

Having said that, writing an OS is something for experts, and -these days- a very complex thing you buy. But if you feel like tinkering, you could start a project like that. A led christmas display or something like that is a nice place to start.
 
MarcoD said:
Personally, programming a microcontroller these days is a lot of fun. There are tons of nice free tools out there, and you get some kind of feeling how it is to write an OS from scratch.

Having said that, writing an OS is something for experts, and -these days- a very complex thing you buy.
A minimal pre-emptive multi-tasking OS doesn't involve a lot of code, perhaps 300 to 500 lines of code depending on how much you put into it. Each task has it's own stack area, so context switching is mostly about saving everything you need to resume a task on it's own stack, then switching stacks, and restoring to continue with another task.

Using a rule that only one task can pend on any specific event makes things a bit easier and quicker since you can include the address of the task control block in the event structure (or zero if no task is pending on an event). (For one task or interrupt to signal multiple tasks at once, multiple events would be required, but that's not a large overhead, and keeps the OS code simple.)

How interrupts are handled can be a bit tricky, since if an interrupt signals a higher priority pending task, you'll need to move some of the context saved by the interrupt process to the current task's stack, before going to a dispatcher to switch context to the higher priority task. Nested interrupts add another layer of complexity, since any level interrupt could signal a task, but the dispatcher isn't called until the lowest current level interrupt is being exited (and only called if a task switch is to be done).
 
Last edited:
Mathematicize said:
Hey everyone,

I am currently in a C and UNIX Systems Programming course, and my professor is not the best to say the least. Does anybody have recommendations on how to learn Systems Programming on your own? Such as, any interesting projects I could do in my spare time with online resources? Or just any general tips? I am kind of a scatter-brained person, great at math and high-level OOP (java and C#). Also, could anybody recommend me a great IDE with a debugger. I have tried XCode for C, but compared to netbeans and visual studio for java and C#, it does not compare in my opinion.

Thanks!

I would get be a simple pic32 controller board with MPLABX.
http://www.microchip.com/pagehandler/en-us/family/mplabx/
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=2615&dDocName=en545713

That's the basic hardware and IDE platform needed to start.
 
Start by reading the book "UNIX Programming", by Kernighan & Ritchie.
 
I did an OS class last year and we made a shell that could execute programs and handle pipes and redirects. It was a really short program, much shorter than I imagined, but the code was tricky. We used this book, and I found it very helpful, but it focuses more on OS theory and not that much on actual programming:

https://www.amazon.com/dp/0136006639/?tag=pfamazon01-20
 
Back
Top