Reputation: 1524
I want to have a go at kernel programming, mostly to understand it more, not to try to create my own OS or anything.
But I am confused as to even what language I need to program in to do this let alone what IDE(if there would be one) & compiler I can use?
I would like to attempt to interact with the Unix kernel (so thats the Linux kernel right & is this a hybrid kernel ?) or the Windows 7 kernel (thats a hybrid kernel isn't it?, the older versions of windows were Monolithic?).
If I want to get into interacting with the above mentioned kernels what language should I use & what compiler(& IDE) can I download to run my code?
Would I be looking at using c(I have done alot of win32 programming so I'm used to c & c++) or assembly for this? Also do you know of any tutorials for interacting with one of those kernels?
Upvotes: 5
Views: 3828
Reputation: 41
Linux Device Drivers is a good point to start learning kernel programming.
Upvotes: 4
Reputation: 8614
All depends what you mean by 'interact with the kernel'. The kernel-user interface used most often in UNIX world are the basic system calls (open, read, write) operating on files (including the device nodes in /dev
and 'special files' in /proc
and /sys
on Linux) and these are available in virtually any language (cat /dev/random
is an interaction with kernel, so the shell is 'language good enough to interact with the kernel').
Also most of the lower level system calls are available directly in most languages: ioctl
, fcntl
, the socket API, etc, but using those may get tricky when internal structures (originally defined in the C language) are in use.
If you want to call the system calls directly (and not the libc wrappers), your choices are generally C, C++ (not even linking with the standard library) or assembler. But going this way makes little sense even as exercise, unless you want to write your own 'libc' or something.
First decide what your goals are and what exact 'interaction' do you want, then choose the easiest solution (high level language you know). I often use Python for 'interacting with kernel' myself.
Upvotes: 4
Reputation: 52417
It is kernel, not kernal.
The linux kernel is written in C. Almost all popular OS kernels are written in C.
You should start with the linux kernel, as I assume you don't have access to the Windows kernel sources. Go to http://www.kernel.org and download them. Look into them. You will find documentation in the package, too.
All this information can also be easily found on Google.
Upvotes: 11