does the shell of an OS have to be written in the kernel? if not, how does the shell communicate with the kernel in a microkernel environment?
thanks in advance,
how do shells relate to kernels?
how do shells relate to kernels?
oh microsoft, microsoft, what souls you have dismayed
Re: how do shells relate to kernels?
A shell is just an ordinary program with ordinary functions and so on. Make a shell in Minix to find out for yourself.com1 wrote:does the shell of an OS have to be written in the kernel? if not, how does the shell communicate with the kernel in a microkernel environment?
thanks in advance,
Re: how do shells relate to kernels?
Hi,
AFAIK this is the same in UNIX - the shell uses it's stderr, stdout and stdin, which are typically connected to it's parent process (e.g. "term").
The kernel is responsible for the communication between these processes, and in a monolithic system it'd be responsible for the device drivers too (video, keyboard, mouse, etc), but apart from that the kernel has nothing to do with the shell - the shell is just another process as far as the kernel is concerned.
Cheers,
Brendan
No, and I can't think of any (non-hobby) OS where the shell actually is implemented in the kernel (MS-DOS used "command.com", Windows uses a DOS emulator running "command.com", Linux/UNIX uses Bash or Ash or C-shell or Z-shell or something else, etc).com1 wrote:does the shell of an OS have to be written in the kernel?
In a micro-kernel environment, the shell would communicate with something that controls the user interface (e.g. a process responsible for virtual terminals), which (eventually) talks to device drivers.com1 wrote:if not, how does the shell communicate with the kernel in a microkernel environment?
AFAIK this is the same in UNIX - the shell uses it's stderr, stdout and stdin, which are typically connected to it's parent process (e.g. "term").
The kernel is responsible for the communication between these processes, and in a monolithic system it'd be responsible for the device drivers too (video, keyboard, mouse, etc), but apart from that the kernel has nothing to do with the shell - the shell is just another process as far as the kernel is concerned.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
Re: how do shells relate to kernels?
For the sake of historical accuracy, I'd like to add that this was only true of Windows 9x/ME and earlier. NT/2k/XP use CMD.EXE, which looks and acts like DOS, but is not a DOS emulator (NTVDM.EXE is the dos emulator, and it can run command.com if you're feeling nostalgic). I think Vista has a new shell ("Powershell", formerly known as "Monad") but I haven't even sneezed in the general direction of Vista yet, so I don't know if this new shell is the default or not.Brendan wrote:Windows uses a DOS emulator running "command.com"
Some more examples of shells that are not in the kernel -- Explorer.exe on Windows, Finder on the Mac (shells can be graphical too).
Top three reasons why my OS project died:
- Too much overtime at work
- Got married
- My brain got stuck in an infinite loop while trying to design the memory manager
- mathematician
- Member
- Posts: 437
- Joined: Fri Dec 15, 2006 5:26 pm
- Location: Church Stretton Uk
As it has been said, the shell is just another application, and, like all applications, it makes calls to the underlying operating system. You could have a shell which was portable at source code level, provided it didn't contain assembly language, but you would need a compiler which could compile it for the intended OS. If that OS was new, as in, "you've just written it," there is unlikely to be a compiler around to do the job. The only thing which makes the shell different from any other application is that it gets itself loaded automatically immediately after the OS has finished initialising.hckr83 wrote:hmmm...anyone know of a portable shell? like portable to different OS's?
By the way, a shell doesn't have to be a command line program. The word "shell" arises from the idea of its being something which wraps itself around the kernel, with the kernel on the inside and you on the outside. Windows primary shell is its GUI (which doesn't nowadays run on top of the command line interface).
Anyway, I imagine that a command line would be the easiest part of the operating system to write. After all, by then you have got a file system, memory manager, i/o to the console....... in fact everything an applications programmer takes for granted. (But unlike most applications programmers, you can go back and implement some more kernel functionality if you need it.)
Try http://en.wikipedia.org/wiki/Category:Unix_shells. Most just require a standard C library, but can use others e.g. readline etc. From the looks of the articles, dash seems to be one of the simplest.hckr83 wrote:hmmm...anyone know of a portable shell? like portable to different OS's?
Regards,
John.
www.sf.net/projects/ncsh -> intended to be portable. It's less than tested, though. It's derived from another project I started (but that was part of a school project), www.sf.net/projects/cdsh. The last one is a bit more tested but uses readline.jnc100 wrote:Try http://en.wikipedia.org/wiki/Category:Unix_shells. Most just require a standard C library, but can use others e.g. readline etc. From the looks of the articles, dash seems to be one of the simplest.hckr83 wrote:hmmm...anyone know of a portable shell? like portable to different OS's?