Learning Systems Programming in C

In summary, the conversation discusses learning systems programming on one's own, including recommendations for online resources and interesting projects. The participants also exchange tips for success in the course and recommend a great IDE with a debugger. They also mention the possibility of writing an OS or programming a microcontroller for practice. Additionally, they suggest reading the book "UNIX Programming" and using a pic32 controller board with MPLABX as a starting point.
  • #1
Mathematicize
11
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
  • #2
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?
 
  • #3
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.
 
  • #4
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:
  • #5
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.
 
  • #6
Start by reading the book "UNIX Programming", by Kernighan & Ritchie.
 
  • #7
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
 

1. What is C and why is it important for learning systems programming?

C is a popular programming language that is widely used for developing operating systems and other system-level software. It is a low-level language that provides direct access to system resources, making it crucial for understanding how computers work at a fundamental level.

2. Do I need any prior programming experience to learn systems programming in C?

While having some prior programming experience can be helpful, it is not necessary to learn systems programming in C. However, a strong understanding of basic programming concepts such as variables, loops, and functions is recommended.

3. What are the benefits of learning systems programming in C?

Learning systems programming in C can provide a deeper understanding of how computer systems work and how software interacts with hardware. It can also improve your problem-solving skills and open up opportunities for developing low-level software and working with embedded systems.

4. Are there any resources or tools that can aid in learning systems programming in C?

There are various online resources, books, and tutorials available for learning systems programming in C. Additionally, there are tools such as compilers, debuggers, and IDEs that can help with writing and testing C code.

5. What are some common challenges when learning systems programming in C?

Some common challenges when learning systems programming in C include understanding complex concepts such as memory management and pointers, debugging errors in code, and dealing with the steep learning curve of a low-level language. It is important to practice regularly and seek help from experienced programmers when facing difficulties.

Similar threads

  • Programming and Computer Science
Replies
6
Views
1K
  • Programming and Computer Science
Replies
8
Views
832
  • Programming and Computer Science
Replies
8
Views
969
  • Programming and Computer Science
Replies
5
Views
912
  • Programming and Computer Science
Replies
3
Views
3K
  • Programming and Computer Science
Replies
6
Views
986
  • STEM Academic Advising
Replies
12
Views
1K
  • Programming and Computer Science
3
Replies
86
Views
10K
  • Programming and Computer Science
2
Replies
59
Views
6K
  • Programming and Computer Science
Replies
14
Views
30K
Back
Top