LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
LinkBack Search this Thread
Old 02-04-2010, 12:51 PM   #1
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: Fedora14,Scientific 6.1?, Mandriva 2010 ;GO MAGEIA!!!Next up Gentoo
Posts: 774

Rep: Reputation: 51
Daemons and the Kernel: Info requested


Because of the lack of Linux O.S tutorials I'm investagating how Daemons work.



Can a Daemon not be in memory and have the application start it? Are there System Services OR Daemons in Linux?
Are Daemons kept out of the Kernel for flexabiltiy?
Does the Kernel rely on Daemons? Are there Kernel Daemon Services?
Are device drivers just basically funtions?
Is there a way to monitor what parts of ther Kernel are running in memory or don't they count?

Iv'e read read everything I could find on the net and If I knew more I would be specific.


Thanks and may the Open Source Deities be with you!

Last edited by theKbStockpiler; 02-05-2010 at 12:36 AM. Reason: Stupidity: Maybe use spell check next time.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 02-04-2010, 02:13 PM   #2
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
Hi,

a daemon is just a program as any other. The difference between programs like a compiler or a media player is that they run in the background, have no controlling tty and are a process group leader (mostly). Furthermore their parent process is init. Normally they provide system services like printing (e.g. cups), servers (e.g. httpd, ftpd, ...) or timing (cron). For a working GNU/Linux system they are mandatory.

Daemons are kept outside the kernel, because for the tasks they should perform, no kernel priviledges are necessary. Thus if they contain errors or are corrumpted by an external attack, they destruction potential is much lower. This results in an increase of security.

The linux kernel does not rely on daemons. Kernel daemons are possible in theory, but should not be used due to security reasons.

A device driver is some piece of code, that tells the kernel how to communicate with the hardware they are written for. Take ALSA as an example:
The ALSA basically consists out of three layers:
A userspace library which provides an abstract interface to the kernel interface. Thus this simplyfies programming enormously. This library is called libasound.

A kernel high level layer. This layer takes the commands from and sends the responses to the userspace via a well defined character device interface (/dev/snd/*). This layer abstracts from the underlying sound hardware and thus is independent of them.

The kernel low level layer. This layer contains the actual code that translates the abstraction from the high level layer to the actual hardware.

With this view in mind, device drivers are just basically functions.

What do you mean by "what parts of the kernel are running in memory"? Do you mean are swapped out? Or being kernel modules not loaded?
 
2 members found this post helpful.
Old 02-05-2010, 12:47 AM   #3
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: Fedora14,Scientific 6.1?, Mandriva 2010 ;GO MAGEIA!!!Next up Gentoo
Posts: 774

Original Poster
Rep: Reputation: 51
Thanks for the Reply

If I use (System Monitor) it does not list everything that ps aux does in bash.

I'm assuming that the Kernel is being paged in and out as well as the processes(shared by Ram) because if the CPU is running application code from memory it is also running kernel code from it depending on how big the kernel code is and if the whole thing fits in Ram or not. I doubt the whole Kernel is always in Ram in other words. It's probably not that important other than knowing if it is implemented by virtual memory or not. So is it? I should most likely go about this from a virtual memory viewpoint.





Last edited by theKbStockpiler; 02-05-2010 at 12:48 AM. Reason: Continued Stupidity
 
Old 02-05-2010, 09:07 AM   #4
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
You can obtain more information on your system by inspecting the /sys/* and /proc/* files. For information on your memory usage /proc/meminfo and on memory in general /proc/iomem. From there I see, that my kernel (including data and bss) occupies 8 Mb of RAM. The kernel is normally not swapped since it is not so big, but this is possible in theory (I think you can used a paged linux kernel for this.). Of course not all parts of the kernel can be swapped.
 
1 members found this post helpful.
Old 05-04-2010, 01:36 PM   #5
ArthurSittler
Member
 
Registered: Jul 2008
Distribution: Slackware
Posts: 124

Rep: Reputation: 29
reference materials for device drivers

Linux Device Drivers third edition, by Corbet, Rubini, and Kroah, describes the more or less current state of the implementation of device drivers in Linux. You can view some or all of it on line, but purchasing the book rewards the authors for their efforts as well as giving you a handy reference. The authoritative reference is, as always, the Linux source code.

Device drivers and most of the rest of the kernel must be resident in memory, but Linux permits you to compile some of the drivers as modules which may be loaded and, in most cases, subsequently unloaded.

Device drivers which interface with hardware devices usually involve special interrupt handler code which responds to actual hardware status. For example, when a disk operation completes or fails, the disk controller hardware generates a physical interrupt signal which causes the CPU to suspend whatever it is doing and execute the interrupt handler routine. Interrupt handlers are special because they can not have parameters and the return from interrupt is physically different from a function return. Of course, they cannot return a value, either, because that would corrupt whatever process was running coincidentally when the interrupt occurred. The interrupt routine must save the state of the CPU on entry and restore the CPU state upon exit. This includes disabling and enabling interrupts, because some parts of an interrupt routine may need to be interrupted by a higher priority interrupt. For example, the timer must be serviced soon enough that a subsequent timer interrupt is not lost to prevent the real-time clock from losing time.

This is just a brief overview of device drivers. The cited book covers the details well. The source code is available for most device drivers and is the ultimate authority on how they work.

Similar books exist for Windows(R) device drivers as well as source code examples and tools for generating device drivers. In Windows(R) you may need to purchase licenses and commit to nondisclosure agreements before you can see the actual software source code.
 
Old 05-04-2010, 01:41 PM   #6
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Arch/XFCE
Posts: 17,802

Rep: Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728Reputation: 728
Quote:
Because of the lack of Linux O.S tutorials
You have got to be kidding---the net is **alive** with tutorials on Linux!!
 
Old 05-04-2010, 11:52 PM   #7
theKbStockpiler
Member
 
Registered: Sep 2009
Location: Central New York
Distribution: Fedora14,Scientific 6.1?, Mandriva 2010 ;GO MAGEIA!!!Next up Gentoo
Posts: 774

Original Poster
Rep: Reputation: 51
I hope you are being sarcastic.

Quote:
Originally Posted by pixellany View Post
You have got to be kidding---the net is **alive** with tutorials on Linux!!

When the Linux box I program finally takes over the world using only C and assembly, I will write a huge blog of how disguting it is for it to take so long and use so many resources to get anything accoplished because of the lack of eductional structure culture in general has.I will do such a great job that everyone will understand just what I mean. Check out how messed up the thread I have in programming of "Info of pointers and variables requested."It blows my mind how something can be interpreted in so many differnt was." I try to find information that does not need alot of pharaphrasing and spend my time on the info that is (intentionaly ment to be understood). If the best tutorial I can find can be interpreted so many different ways we have a problem. I have sought after classes that are in line with Linux but there are none. There really is not much on Linux OPERATING SYSTEMS ON THE NET IN PARTICULAR. If you want to see some horrible writing check out "Linux tutorial".I don't have enough time to tell them how bad their site is.They are not helping the cause.

ArthurSittler Thank you for the additional info

Serendipity to all

Last edited by theKbStockpiler; 05-04-2010 at 11:56 PM. Reason: I think some people are just in it for a cheap thanks
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
The requested URL/sever-info not found on this server narsimha.v Linux - Newbie 1 01-17-2008 08:54 AM
kernal panic after update redhat enterprice 4 from kernal(2.6.9-5) to kernal(2.6.9-42 TAREK-SALAMA Linux - Enterprise 3 09-10-2006 09:07 AM
Kernal modules on a Newly Compiled Kernal sethgeekx86 Slackware 4 05-03-2004 11:08 PM
How do you configure the kernal, overwriting the old version of the same kernal? sabaka Linux - Newbie 13 10-04-2003 10:00 AM
Help! Configuring Kernal failed, GRUB can't boot new kernal, help! sabaka Linux - Newbie 4 09-16-2003 09:12 PM


All times are GMT -5. The time now is 11:38 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration