Kernel
Re:Kernel
1. More or less, it is however a program that MUST be self contained, unlike a "user application", the kernel has nothing to rely on, it must do everything itself (draw to the screen, convert IRQs into meaningful events, understand user input, etc).
2. This is far too vague. You can use a bootsector and a BIOS interrupt to print text to the screen. Compile the assembly using NASM and use a utility like partcopy or debug to write to the disk (on windows) or you might be able to do something like "cat bootsect.bin > /dev/fd0" on Linux.
3. See point 1, user applications make use of Operating system services like printf, scanf, getchar, drawline, drawtext, etc, etc. The operating system on the other hand must provide those services, since they don't exist until the OS provides them.
2. This is far too vague. You can use a bootsector and a BIOS interrupt to print text to the screen. Compile the assembly using NASM and use a utility like partcopy or debug to write to the disk (on windows) or you might be able to do something like "cat bootsect.bin > /dev/fd0" on Linux.
3. See point 1, user applications make use of Operating system services like printf, scanf, getchar, drawline, drawtext, etc, etc. The operating system on the other hand must provide those services, since they don't exist until the OS provides them.
Re:Kernel
a kernel is a program, the primary difference is that is it a program whose function is to run other programs and manage resources of the system.
it provides the basic operating environment that programs designed for a given system expect to have in order to function.
a formal definition is as follows:
Operating System: Software designed to control the hardware of a specific data-processing system in order to allow users and application programs to make use of it.
proxy
it provides the basic operating environment that programs designed for a given system expect to have in order to function.
a formal definition is as follows:
Operating System: Software designed to control the hardware of a specific data-processing system in order to allow users and application programs to make use of it.
proxy
Re:Kernel
My try at the definitions:
Kernel: A binary code file that is present in each process' space which handles the direct connection with the hardware and everything that must be kept outside of user space for security reasons. This might include memory allocation and such.
Then you have a library set that connects the kernel system calls (which are not normal functions and limited in programmer friendlyness) into normal programmerfriendly function calls with added functionality, plus the stuff that is needed to make your language fully functional (c++ exceptions, rtti, new/delete, malloc/free etc.).
Then you have normal programs which use the libraries, which use the kernel, which communicates to the hardware.
Plus a little extra program called a bootloader which loads it all into memory so you can actually run something.
Kernel: A binary code file that is present in each process' space which handles the direct connection with the hardware and everything that must be kept outside of user space for security reasons. This might include memory allocation and such.
Then you have a library set that connects the kernel system calls (which are not normal functions and limited in programmer friendlyness) into normal programmerfriendly function calls with added functionality, plus the stuff that is needed to make your language fully functional (c++ exceptions, rtti, new/delete, malloc/free etc.).
Then you have normal programs which use the libraries, which use the kernel, which communicates to the hardware.
Plus a little extra program called a bootloader which loads it all into memory so you can actually run something.
Re:Kernel
You might try reading the talking to a bare bone computer to get more ideas of the difference.
Re:Kernel
To me a kernel is a program that once loaded, does not relied on any other program to be loaded to run, as such if you made a bootable game, then it would have a built in kernel.
My kernel in my OS is a mz exe, it can run other programs that need it for functions, but it can just as easily be run from dos as a normal exe.
Example:
This code will put you in pmode and print a string.
ps: you must have the same spacers in the string, for the code to print the string.
My kernel in my OS is a mz exe, it can run other programs that need it for functions, but it can just as easily be run from dos as a normal exe.
Example:
This code will put you in pmode and print a string.
Code: Select all
;************************************
; \\|//
; (@ @)
; ASHLEY4.
; Put test.bin on boot sector
; with rawrite.
; Assemble with fasm
; c:\fasm test.asm test.bin
;************************************
org 0x7C00
use16
;****************************
; Realmode startup code.
;****************************
start:
xor ax,ax
mov ds,ax
mov es,ax
mov ss,ax
mov sp,0x7C00
;*****************************
; Setting up, to enter pmode.
;*****************************
cli
lgdt [gdtr]
mov eax, cr0
or al,0x1
mov cr0,eax
jmp 0x10: protected
;*****************************
; Pmode. ;-)
;*****************************
use32
protected:
mov ax,0x8
mov ds,ax
mov es,ax
mov ss,ax
mov esp,0x7C00
;*****************************
; Turn floppy off (if space).
;*****************************
mov dx,3F2h
mov al,0
out dx,al
lea esi,[msg0]
???mov edi,0xB8000 + (80 * 3 + 4) * 2
???mov ecx,28
???cld
???rep movsb
jmp $
;*************************************
; GDT.
;*************************************
gdt: dw 0x0000, 0x0000, 0x0000, 0x0000
sys_data: dw 0xFFFF, 0x0000, 0x9200, 0x00CF
sys_code: dw 0xFFFF, 0x0000, 0x9800, 0x00CF
gdt_end:
gdtr:??? dw gdt_end - gdt - 1???
??? dd gdt
;*************************************
; Data.
;*************************************
msg0 db " H E L L O W O R L D ! "
;*************************************
; Make program 510 byte's + 0xaa55
;*************************************
times 510- ($-start) db 0
dw 0xaa55
ps: you must have the same spacers in the string, for the code to print the string.
Re:Kernel
I think your definition is already conception-oriented. Why should the kernel be present in each process space ? It is not mandatory.Candy wrote: Kernel: A binary code file that is present in each process' space which handles the direct connection with the hardware and everything that must be kept outside of user space for security reasons. This might include memory allocation and such.
A quite good overview is at http://en.wikipedia.org/wiki/Kernel_(computers)
Re:Kernel
I think even that definition goes a little too far. In my opinion a kernel is the primary resource manager.
What that actually entails is completely dependent on what you believe to be a primary resource.
Eg
A small micro-kernel operating system might think of processor time, memory and IPC mechanisms as primary resources that are managed by the kernel.
An operating system with a more monolithic approach might also think the network stack and network hardware are primary resources that should be managed by the kernel.
What that actually entails is completely dependent on what you believe to be a primary resource.
Eg
A small micro-kernel operating system might think of processor time, memory and IPC mechanisms as primary resources that are managed by the kernel.
An operating system with a more monolithic approach might also think the network stack and network hardware are primary resources that should be managed by the kernel.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Kernel
Hmm, the fact kernel proposes *abstraction* over what's available is also crucial, even if -- in the case of microkernel -- very few kind of abstractions can be available (microkernels typically only offer the 'thread', 'team' and maybe 'address space' abstractions)Curufir wrote: I think even that definition goes a little too far. In my opinion a kernel is the primary resource manager.
- Colonel Kernel
- Member
- Posts: 1437
- Joined: Tue Oct 17, 2006 6:06 pm
- Location: Vancouver, BC, Canada
- Contact:
Re:Kernel
I always thought of the kernel strictly as the portion of an OS that runs in the privileged mode of the processor. All the complexity is really in defining "OS".
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
-
- Member
- Posts: 1600
- Joined: Wed Oct 18, 2006 11:59 am
- Location: Vienna/Austria
- Contact:
Re:Kernel
@colonel kernel: I'd define it rougy that way too.
the kernel abstracts hardware/software events and routes them to the responsible services/tasks and/or triggers corresponding actions in order to deal with a certain event. Mostly - in a micro kernel - it will forward the events to responsible tasks in form of messages (ipc), manage address space (memory mgmt) and TCB's and abstract the interrupts - hardware or software interrupts - which I call events.
Things like GUI, File System, Process/thread management need not necessarily stay in ring0 but can be processes of their own - so they get events routed throu if a user space process wants something to be done - in the micro kernel world of things.
just my 2 cent.
the kernel abstracts hardware/software events and routes them to the responsible services/tasks and/or triggers corresponding actions in order to deal with a certain event. Mostly - in a micro kernel - it will forward the events to responsible tasks in form of messages (ipc), manage address space (memory mgmt) and TCB's and abstract the interrupts - hardware or software interrupts - which I call events.
Things like GUI, File System, Process/thread management need not necessarily stay in ring0 but can be processes of their own - so they get events routed throu if a user space process wants something to be done - in the micro kernel world of things.
just my 2 cent.
... the osdever formerly known as beyond infinity ...
BlueillusionOS iso image
BlueillusionOS iso image
Re:Kernel
Hi,
In several places I've seen "kernel" defined as the part of an OS that contains the task switching code. This definition is also flawed (relies on how you feel like defining "task" and doesn't work for single-tasking OS's).
IMHO the only good definition for "kernel" is a definition defined by the developer of each OS for their OS only. This is why good documentation has a glossary and/or "terms and abbreviations". The same applies to other terms, like "process", "task", "thread", "segment", "message", etc.
Cheers,
Brendan
Would that mean everything in DOS is part of of the kernel?Colonel Kernel wrote: I always thought of the kernel strictly as the portion of an OS that runs in the privileged mode of the processor. All the complexity is really in defining "OS".
In several places I've seen "kernel" defined as the part of an OS that contains the task switching code. This definition is also flawed (relies on how you feel like defining "task" and doesn't work for single-tasking OS's).
IMHO the only good definition for "kernel" is a definition defined by the developer of each OS for their OS only. This is why good documentation has a glossary and/or "terms and abbreviations". The same applies to other terms, like "process", "task", "thread", "segment", "message", etc.
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:Kernel
Witty reply #1:Brendan wrote:Would that mean everything in DOS is part of of the kernel?
DOS runs in real mode, in which the concept of privilege levels doesn't exist. Therefore, DOS really doesn't have a kernel.
Witty reply #2:
Many would claim that DOS isn't a real OS in the first place.
But seriously, that's a good point... I can imagine an embedded OS where all code runs with full hardware privilege. Some people might name such beasts as "executives" or something other than "OS", which might be fair. Or, you could say they're OSes where absolutely everything is part of the kernel. I've never thought about single-tasking systems like DOS in this context, so I really don't know what to call it...
What bugs me about loose definitions of "kernel" is when people claim things such as "NT is a microkernel" because on the NT architecture diagram there's a little box labeled "kernel" right at the bottom that doesn't include the device drivers, I/O manager, security, virtual memory manager, etc. This is a load of hooey because all that stuff runs in ring 0 and is mapped into every address space, so in my mind it's all part of the kernel 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
Re:Kernel
On the other side, someone (can't remember who) edited the Wiki to claim that the Linux kernel ain't monolithic, because there are modules you see... (Still no offense intended.)
In the books I read, "kernel" is more or less canonically defined as the part of the OS that does the multiplexing of the hardware, with or without abstraction.
That would fit in nicely with the "DOS has no kernel" observation above - DOS doesn't do any multiplexing, the running program controlls all of the system until it exits and reloads command.com.
In the books I read, "kernel" is more or less canonically defined as the part of the OS that does the multiplexing of the hardware, with or without abstraction.
That would fit in nicely with the "DOS has no kernel" observation above - DOS doesn't do any multiplexing, the running program controlls all of the system until it exits and reloads command.com.
Every good solution is obvious once you've found it.
Re:Kernel
Yes, I think your pointing the difference between a Kernel and an Operating System.Solar wrote:That would fit in nicely with the "DOS has no kernel" observation above - DOS doesn't do any multiplexing, the running program controlls all of the system until it exits and reloads command.com.