Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Learning Systems Programming in C

  1. Feb 24, 2012 #1
    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!
     
  2. jcsd
  3. Feb 24, 2012 #2

    rcgldr

    User Avatar
    Homework Helper

    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?
     
  4. Feb 24, 2012 #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.
     
  5. Feb 24, 2012 #4

    rcgldr

    User Avatar
    Homework Helper

    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: Feb 24, 2012
  6. Feb 24, 2012 #5

    nsaspook

    User Avatar
    Science Advisor

    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.
     
  7. Feb 26, 2012 #6
    Start by reading the book "UNIX Programming", by Kernighan & Ritchie.
     
  8. Feb 27, 2012 #7
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Learning Systems Programming in C
Loading...