
Ask HN: Web Developer looking to move to Systems Programming seeking advice - blobfish
I&#x27;ve been working as a PHP developer for almost 7 years now. I started doing small PHP projects while still studying for my CS degree and it sort of progressed from there. This career path worked more or less fine for me as it always provided decent income, jobs were fairly easy to find and at times projects were fairly interesting too. However at a personal level I was never really interested in the subject and on my free time I always found myself hacking on something else.<p>At this point I feel that to continue working as a programmer I need to change my field. Programming can be very interesting and rewarding experience to both programmer and surrounding community, but it can also turn the other way around if you lose your motivation.<p>My real passion lies in systems programming I believe as I was always interested in operating systems, programming languages, algorithms and related stuff.<p>I would be very interested to hear if anyone did a similar transition to systems programming and how did it go. How long did it take for you to learn everything? Did you take a more general approach or did you target a very specific area? How long did it take to get your first job as a systems programmer and what it was?<p>Any kind of related experiences would be very helpful to me when making this decision. Thank you.
======
AnimalMuppet
You need to understand that systems programming is _very_ different from PHP.
You have to worry about many more conditions. (What if another thread calls
function X, just before someone calls this function? I need a mutex to protect
this data structure. But what are the performance effects of that? Do I need
to think about how multiple cores affects this? Etcetera...)

~~~
blobfish
Yes, I'm aware of what is involved in systems programming and what kind of
problems I might end up solving. However my knowledge is mostly theoretical or
based on spare time hacking or university classes practice. The point you are
raising is valid though. One should be aware where he is going to stick his
nose :)

Based on your previous post I see that you are an embedded developer. Would
you mind to shortly tell how you started and what you found most difficult or
most important in the beginning or even later in your career?

~~~
AnimalMuppet
How I started: I got hired right out of college (with a math and physics
degree, not CS) for an embedded position. From that start, I've been in
embedded for almost all of my career.

What I've found to be important/different: Debugging can be really hard. You
can't always run a debugger; you can't always print something out. Sometimes
bugs can come from interaction between different threads, which is something
that you don't run into in many kinds of programming. You have to watch for
multiple threads accessing the same data, and you have to figure out what you
need to do if it happens. You need to remember that any thread can stop
running between any two assembly instructions - a C statement is _not_ atomic.

I've never done system programming, but in ignorance I think it's harder than
what I do. It's got all of my problems, plus a bunch more...

~~~
blobfish
What would be the situation in which you can't run debugger? Is this when the
issue can't be reproduced in dev environment?

~~~
AnimalMuppet
You can't run a debugger when you don't have room on the embedded device for
the debugger. You can't run one if you don't have communication with the
device (if you're installing code by physically inserting ROM chips in
sockets, and don't have a serial port or ethernet connection to it.

And you can only run a debugger with great difficulty if your system is
handling real time events, and if the debugger hits a breakpoint, you mess up
the timing so that the behavior from that point on is completely changed. You
might be able to get the information that the breakpoint triggered, and what
the variables are at that point in time, but you can't continue from there and
see how execution proceeds.

------
tbirdz
I am not a systems programmer myself, but if you are looking for resources, I
can recommend the book "Computer Systems: A Programmer's Perspective". We used
this textbook in some systems classes I took in school, and I thought it was
pretty helpful and informative.

~~~
blobfish
Thank you. I will definitely have a look at that book.

This is what I have on my list so far:

The C Programming Language

C Interfaces and Implementations: Techniques for Creating Reusable Software

Expert C Programming

Algorithms in C, Parts 1-5 (Bundle): Fundamentals, Data Structures, Sorting,
Searching, and Graph Algorithms

Structure and Interpretation of Computer Programs

Introduction to Algorithms

Compilers: Principles, Techniques, and Tools

Hacker's Delight

Cracking the Coding Interview: 150 Programming Questions and Solutions

Advanced Programming in the UNIX Environment

~~~
crpatino
I am familiar with maybe half of the books you mention, and the selection
seems quite solid. I would however recommend to spend less time reading and
more time hacking. Also, try to approach this as a series of steps, not
everything in one go:

1\. Learn C, the Language: You should already know the basic components of
structured programming (functions, loops, conditionals, etc). As PHP user you
probably are somewhat familiar with C standard library (with PHP just puts a
thin layer on top of), but you are a false beginner here because you need to
learn to be much more careful with manual memory management, compiler erros vs
warnings. Just pick some project whose specification is dead simple (a little
console based game like sudoku might do) and build it from the bottom up.

2\. Learn C, the Runtime: Get deeper into standard library functions. Pick
something more sophisticated in terms of I/O. Learn the difference between
static vs dynamic linking, and try to work around it just for the sake of it
(make your own malloc is a classic).

3\. Learn C, the Unix's companion. Figure out what a system call is and how it
is unlike a regular function call. Learn Linux (I know you mentionen MINIX
elsewhere, and it would be valuable in a 4th or 5th step, but for the sake of
employability it is better to be a power user of a mainstream system than an
expert in an academic one). Figure out stuff like virtual memory, how it works
and how to affect it at the C level (which should be transparent, and mostly
is but not 100%).

~~~
blobfish
I was thinking somewhere on the similar lines when deciding how to approach
this. I split the process into 3 initial steps as well.

1\. Learn the C language. Read K&R book, then get my hands dirty with some
relatively simple problems. Here I'm actually deciding between practicing with
algorithmic problems and doing a simple project or I can probably do both.
Anyway I'm leaning towards algorithms because they normally are short enough
to be possible to work on with the minimal amount of knowledge on the standard
library and are complicated enough to be a good practice, particularly when it
comes to performance and memory usage. This approach would also make me learn
how different data structures are handled in C and how to deal with memory
management.

2\. Learn systems programming. At this step after some initial reading I would
like to join a relatively small open source project and try to fix some bugs
or contribute some small changes to it. I didn't decide yet what particular
project it could be so any suggestions are welcome :) At this step I should
become comfortable with writing C and gain some basic knowledge on systems
programming.

3\. Get deeper into systems programming. This is were I'm deciding between
taking on Linux/BSD or MINIX. I suppose MINIX should work very well as a
learning tool for OS design and implementation. So it could make transition to
Linux/BSD easier. At this stage I could probably join some open source OS
project.

What comes after that I'm not quite sure. There may be more steps involved or
I may be ready to look for a job at this point.

I may also need to decide what exactly I want to work on which leads me to the
difficult question I raised to myself when thinking about this. Should I
specialize from the very beginning or can I be a generalist with a strong
general systems programming knowledge and then get to the details when the
need arises based on particular job?

------
Hattori-1
Advanced Programming in the UNIX Environment is a very detailed book which
will refresh a lot of concepts. Needless to say C skills need to be polished
(K&R). Or you can go the hard way and start contributing to the testing of
Linux kernel.

~~~
blobfish
Joining an open source project will probably be necessary for me in order to
get decent level of hands on experience. There is also a possibility of
getting some mentoring which would be really good for me.

What do you think about MINIX as a learning tool? It seems to look as a good
place to start but I don't know much details about it's internal design except
that it's using a microkernel which is different from most operating systems
in use today. So I'm not sure about the practicality of spending time on
MINIX. My other open source project choices would probably be Linux or one of
the BSDs.

