Do I have to learn C to understand Linux?
Hi everyone!
I'm using Linux since quite a while now and I'm happy to notice that I'm beginning to "know my way round". I can write little bash, sed and awk scripts to help me with my everyday tasks and I've also had a thorough look at Python, which is ideally suited for helping me with my work, which is linguistic research, i.e. mainly text processing. However, this does not seem to be of much use in understanding and modifying source code of Linux applications, 90% of which seem to be written in C. I do not want to write revolutionary new programs, I'd just like to look under the hood of some Linux apps and perhaps write a little patch here and there to adapt them for my purposes and, in this way, maybe even contribute back to the Open Source community one day. Do I have to learn C now? At first glance, this doesn't look at all like the newbie-friendly "written pseudo-code" walk-in-the-park that is Python! Variable declarations, pointers, memory allocations... I'm scared! My main concern is: Is it even feasible to learn enough C for the above purposes in my restricted spare time (which would be pretty much 8 PM till 8 AM! ;)), or should I leave that to the computer science students and full-time Linux hackers? I would be glad if you could tell me about your own experiences with C and Linux -- and whether I should or shouldn't learn it from your point of view. With best regards, Rehceb |
It depends on what you want to do. If you want to learn how to write hardware drivers or system commands then you will really need to know C and Assmebly very well. If you want to write an application you have more flexibility in what to pick. For example, a lot of application delevelopers pick a combination of PHP and Perl which are a lot more simple than C or C++. With PHP, Perl and Apache you can develop web applications. The way I see it, C is more for optimized system programs, libraries, kernel drivers and services.
|
If you are curious enough about it to post this thread then why not just give it a go and see where it takes you.
I feel that learning C has enriched by Linux experience. Like you,I did it in my spare time. I'm no guru but I can make apps for myself to do this and that. I am getting better at reading other peoples code,i've modified a couple of things etc and it just gives you an appreciation of what is going on under the hood so to speak. :0) |
Quote:
|
I don't really think you necessarily need to know C to fully comprehend Linux.
The closest I come to knowing C is Java. I've had attempts at learning C++, but that always fell apart for me, as I saw little to no point in a few aspects (these aspects weren't C++-specific, but were "paradigms" in object-oriented programming). The languages I've settled on are (in order of use): Common Lisp, Python, Java, Bash scripting and KornShell scripting. I know more languages, but there isn't anything I can't do in any of those languages. Moreso, while learning Common Lisp, I finally understood the reasons/purposes behind some things I had only ever, previously, come across in C/C++ books that were just supposed to be accepted and not understood. I suggest giving Common Lisp a look over; warning, though, it's weird. I use Common Lisp almost exclusively, however. It grants me what I need, to the extent that I rarely ever touch Java or Python. :) |
Quote:
About the subject: (personal opinion)I think someone should have at least some basic programming skills (language doesn't really matter, as long as it's not Prolog :)) to work with linux effectively. |
Quote:
#2. To *FULLY* comprehend Linux you must know C, amongst other things. Take a while and ponder of the meaning of "FULLY". Quote:
Quote:
Quote:
|
Quote:
Also, some of the libraries that you would use to write a program in C have Python bindings so you can use them in Python. Try entering "Python wrapper" in Google. |
Wow, I'm getting shredded for my comment about C and Java.
introuble: Comprehension is subjective. :) I don't necessarily need to know what went in to it, just to know how it works. It's like machining, it doesn't matter if I use a fly-cutter or an endmill; they both have their particular applications, but can both achieve the same result. What I was trying to say, and should have made clearer in my previous post, is that you can get away with knowing HOW Linux works without an intricate knowledge of C. Elaborating, knowing C can explain how to, programmatically, detach a process from the current TTY and have it run in the background passing all output to either a log file or /dev/null, but that knowledge of C isn't needed to know how to do it in, say, a system administration script. Depending on what kind of programming is desired here, which I believe the OP has made clear as open-source application development, the language to be used, is going to be, simply decided on the project. Kernel modules and development - C; GUI/application - C, C++, Java (I'm excluding Python from this as it does not have an intrinsic graphics library unto itself - it makes use of Qt and GTK+ library wrappers); System administration - Expect (Tcl/Tk-subset), native shell scripting, Python; AI programming/neural net development - Common Lisp, Prolog; Mathematics - Common Lisp, Scheme, Algol; Device driver development - C, 80x86 assembly, 80x86_64 assembly, GNU/Linux kernel assembly; Generic system development - C, C++, Python (see the Unununium project)... |
Quote:
Higher-level assembers (with macros support) have a lot of features that make them similar to C/or other non-OOP languages - for example, they have wrappers that handle function calls, loop and if/else situations. They have structures, constants, a simple preprocesor, etc. The only difference there is that assembler still uses asm instructions instead of predefined library functions, and that assembler still have to declare memory model, etc. I think that C provides just enough features to write low-level functions (kernel :)) without having to write unportable assembler instructions. |
Moo-cow has probably taken up golf instead now anyway.
|
Quote:
Having taken a closer look at C and pondered your comments I decided that C is indeed manageable and useful, but a bit too time-consuming for now, as I'm writing my master's thesis. But as soon as I'm done with it, I can reward myself by finally learning C. Now I'm at least motivated to finish the darn thing. Until then, I'll take comfort in learning a bit of Elisp, which lends itself to occasional Emacs-hacking just for the fun of it. Maybe I'll even like it, what I somehow doubt, though, as "Lisp has all the visual appeal of oatmeal with fingernail clippings mixed in" (Larry Wall). :D Thanks for your opinions! moo-cow |
i hope your not a CS major! :p whats your thesis on?
|
Quote:
|
Quote:
|
All times are GMT -5. The time now is 06:03 AM. |