This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
gamax92's profile picture

What makes an Operating System

Started by gamax92, 18 March 2013 - 04:38 AM
gamax92 #1
Posted 18 March 2013 - 05:38 AM
How does the operating system stand within the Computer?
  1. Hardware: ComputerCraft really isn't hardware, so this would be any peripherals and the terminal
  2. Operating system: The operating system manages the hardware, and sets up interfaces for applications to use.
  3. Applications: The applications run in the environment the Operating system sets up. Depending on how the application is started, the application can have lots of privileges or barely any.
  4. The user: The user is you. You interface the Operating system via the Applications running in the Operating system. The application sets up its own interface for use you to interact with.

What composes an Operating System?
The Operating system is the main component, and can be divided into subsections:
  • Kernel: The kernel is the heart of the operating system. It is responsible for managing hardware, setting up interfaces, and making protected modes for which programs run in.
  • With lua, we have the pcall function. We also have setfenv that can limit the functions in the processes global table.
  • Drivers: Drivers are sorta like an api. They manage their specific hardware or hardware set and translate that into something the kernel can use.
  • Which inturn allows the kernel to provide the Application access to that device if the kernel allows.
  • Multitasking: First off, multitasking is not needed for the operating system to function. Multitasking allows for multiple programs to run simultaneously, including the kernel. Using coroutines, this can be achieved easily.
  • Filesystems: Since in ComputerCraft the diskdrive or fs api doesn't access a random glob of data and translates it into files and folders, this is quite different in handling by the kernel.
  • In ComputerCraft, this is manageing the fs api, making a large file and using that as a partition, or doing both using the large file as an addon to the fs api.

Linux isn't the only Operating System with a kernel:
Linux comes with a kernel sometimes called vmlinux, vmlinuz, uImage, or zImage. It doesn't need to be called this.
Windows 2000+ has ntoskrnl.exe
MSDOS has MSDOS.SYS, which after 7.0 got merged to IO.SYS
FreeDOS has KERNEL.SYS
OS/2 has OS2KRNL
The Windows 9x family had kernels
Windows 3.11 had a kernel.
Not only linux comes with an Operating System kernel.

Some important notes
Security is very important.
Try your best when making one to be sure that the program cannot fool the kernel into getting more access than it should.
Also, making sure that the programs that have access to the filesystem api cannot delete the kernel.
You don't have to be black and white when giving programs access to certain things. It is possible to only give a subsection of an api.

Example of how hardware of the computer gets access via each limited program execution:
The hardware is a screen, the computer itself (lua), a disk drive, and a modem.
The operating system takes over all of the hardware, except it was built without the knowledge of the modem, so it becomes unused.
The operating system runs a program that can only access the screen and the computer, the disk drive and modem are now unused.
The programs makes an interface that only prints one line when you click on a certain area. Now several features of the screen, the disk drive, and modem are unused.
Sammich Lord #2
Posted 18 March 2013 - 05:50 AM
May I ask what the point of this topic is?
gamax92 #3
Posted 18 March 2013 - 05:51 AM
Ń̲͚̳̞̰̯oͅt̵̼̟̣h͏̻̭͍̦̞͉̩i͍͖ṉ͎̫̹͕͎̹g̬̼
SuicidalSTDz #4
Posted 18 March 2013 - 06:13 AM
Ń̲͚̳̞̰̯oͅt̵̼̟̣h͏̻̭͍̦̞͉̩i͍͖ṉ͎̫̹͕͎̹g̬̼
So this is just a pointless topic?
zekesonxx #5
Posted 18 March 2013 - 07:09 AM
Apparently.
SuicidalSTDz #6
Posted 18 March 2013 - 07:27 AM
Well, it's not so pointless. Some clueless members might want to read this before making an os. Actually yeah! I advise every clueless member wanting to make an OS, to read this first. Maybe it will enlighten upon some new ideas instead of a nub lock.
spyman68 #7
Posted 18 March 2013 - 07:37 AM
Well would making a basic touch screen desktop with real PC like functions be counted as an OS?
SuicidalSTDz #8
Posted 18 March 2013 - 07:58 AM
An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs. The operating system is a vital component of the system software in a computer system. Application programs usually require an operating system to function

I think you know the answer now

People who think a lock is an OS are wrong and should be shunned for this. OS's are a much more complex than the new members see them to be. I wish they would start with something small, like a card game, tic tac toe, or something along those lines. OS's should be left to the people that know how to make them. This is only my opinion and this should not prevent you from making an OS.
gamax92 #9
Posted 18 March 2013 - 10:05 AM
Well would making a basic touch screen desktop with real PC like functions be counted as an OS?

No. There is no such thing as an Operating system in ComputerCraft.
oeed #10
Posted 18 March 2013 - 10:09 AM
This is a good idea, but I think you should change the title to something like "What is/isn't an Operating System"
gamax92 #11
Posted 18 March 2013 - 10:23 AM
This is a good idea, but I think you should change the title to something like "What is/isn't an Operating System"
Changed the title. If anyone has any suggestions or changes that I can add to the main post, please post here or pm me.
AnDwHaT5 #12
Posted 18 March 2013 - 12:21 PM
How does the operating system stand within the Computer?
  1. Hardware: ComputerCraft really isn't hardware, so this would be any peripherals and the terminal
  2. Operating system: The operating system manages the hardware, and sets up interfaces for applications to use.
  3. Applications: The applications run in the environment the Operating system sets up. Depending on how the application is started, the application can have lots of privileges or barely any.
  4. The user: The user is you. You interface the Operating system via the Applications running in the Operating system. The application sets up its own interface for use you to interact with.

What composes an Operating System?
The Operating system is the main component, and can be divided into subsections:
  • Kernel: The kernel is the heart of the operating system. It is responsible for managing hardware, setting up interfaces, and making protected modes for which programs run in.
  • The kernel isn't something that only linux has.
Ok this crap is driving me crazy you mean software hard ware is physical like in a real computer ram(memory), a hdd, ssd, motherboard, disk drive, universial serial bus drive(USBD). Software is programs like java, minecraft, computercraft, google chrome, mozila, explorer, what have you ok. Sorry i got a little OCD if you know what i mean. :P/>
a example of hardware for cc would be a monitor or a printer or a diskdrive or a modem what have you. Also thank you for taking you time to right something like this.
FuuuAInfiniteLoop(F.A.I.L) #13
Posted 18 March 2013 - 12:38 PM
You should post a example OS that follow these…
gamax92 #14
Posted 25 March 2013 - 11:39 AM
After a lengthy discussion on the IRC, I've decided to change the content of the post.
Although this topic is no longer useful thanks to the changes, I believe it is correct.
If you'd like to debate this idea, then please do so. but it is true, no matter what you say.
You can only get close to being an OS, but you cannot make an OS. I'm sorry for ruining this topic and I'm looking to have it deleted.

Please come onto the IRC if you'd like to talk. My nickname is gamax92 or Aucarndia.


This nolonger applies, I feel bad about what I did and I'm gonna restore the content of the original post.
Mads #15
Posted 25 March 2013 - 10:27 PM
This topic should be sticky.
oeed #16
Posted 26 March 2013 - 09:55 AM
You should have kept the original post. This is no longer helpful to new users in anyway.
Azhf #17
Posted 27 March 2013 - 02:07 PM
Something you can't make in ComputerCraft, so stop trying.
Not to be offensive, but you jumped right into douche-bagginess. If someone wants to make an OS, then let them. If you don't want to see them anymore then go start your own forum, and ban OS-related topics. Some people grew up having different ideas of what stuff is. Red might ACTUALLY be red for you, but if someone was a baby and everyone told them red was actually called green, they would call red green, which would make it different opinions for you. So if someone grew up just knowing the basics of an OS rather than it right down to the core, then it would be different things for them. Sorry if I went too in-depth X3
oeed #18
Posted 27 March 2013 - 07:11 PM
Something you can't make in ComputerCraft, so stop trying.
Not to be offensive, but you jumped right into douche-bagginess. If someone wants to make an OS, then let them. If you don't want to see them anymore then go start your own forum, and ban OS-related topics. Some people grew up having different ideas of what stuff is. Red might ACTUALLY be red for you, but if someone was a baby and everyone told them red was actually called green, they would call red green, which would make it different opinions for you. So if someone grew up just knowing the basics of an OS rather than it right down to the core, then it would be different things for them. Sorry if I went too in-depth X3

I completely agree with you. Many people put hours of work in to their software/program etc, and just because they call it an 'OS' means that its stupid and should be banned?
Pinkishu #19
Posted 27 March 2013 - 10:53 PM
  • Operating system: The operating system manages the hardware, and sets up interfaces for applications to use.
So, something that manages the terminal + peripherals and sets up interfaces (APIs) for the lua programs on the PC? :P/>

You can even make a kernel taht allows programs to run in protected modes and stuff…
PonyKuu #20
Posted 27 March 2013 - 11:32 PM
I'm not sure… May I ask what is the CC OS? I know what is real OS, bu CC ones seem to be different There are a lot of "OS"es, and a lot of OS discussions, but I don't even understant what is it, why I need one and what is the point of OS making. The main reason for this might be the fact that I feel CC as very powerfull utility mod and use it for some practical things, such as farming, mining and so on. So, for example? those doorlocks that can be overrided by pickaxe don't make sence for me…
Cranium #21
Posted 28 March 2013 - 04:16 AM
As quoted before, here is the proper, and commonly accepted definition of an Operating System:
An operating system (OS) is a collection of software that manages computer hardware resources and provides common services for computer programs. The operating system is a vital component of the system software in a computer system. Application programs usually require an operating system to function.
Source
Let's go over the main points of that shall we?
  • "Manages computer hardware resources"
    • This is part of the OS built into CraftOS. The functions and APIs built into the BIOS allow code being executed to control different peripherals, as well as output signals. We have modems, disk drives, peripheral cables, and even other computers as being hardware that the OS can control and access.
  • "The operating system is a vital component of the system software in a computer system"
    • Without the CraftOS, you would have to interface directly with the core code of the system which is the BIOS. Definitely possible through creatign new programs to replace everything, but not preferrable. You could liken this to removing the operating system on your computer, and accessing the hardware directly through the BIOS of your computer.
  • "Application programs usually require an operating system to function"
    • Again, without CraftOS, you would have a very difficult time doing anything. You would have to write your own directories, your own input system, and your own output system to determine what is happening after you execute code.
So before you go off the handle, it is entirely possible to write a completely new operating system in ComputerCraft. Please don't be so close minded because of your programming skill shortcomings. I would never attempt to write an Operating System, because I am nowhere skilled enough to write one without causing problems.
Tiin57 #22
Posted 28 March 2013 - 04:28 AM
I'm sorry, but I have to butt in here obnoxiously.

Your source is Wikipedia? I honestly trust Wikipedia, because the moderators on there are so quick (Lochie says he's one of them, IIRC), but no one else seems to. Credibility is key, young grasshopper.
Cranium #23
Posted 28 March 2013 - 04:59 AM
Yes. That's my source. I go there when I want a quick definition. If I want some actual research, I'm going to go to a more established resource like a library. Wikipedia is not always right, unless it is just a simple definition.
Pinkishu #24
Posted 28 March 2013 - 07:00 AM
I'm sorry, but I have to butt in here obnoxiously.

Your source is Wikipedia? I honestly trust Wikipedia, because the moderators on there are so quick (Lochie says he's one of them, IIRC), but no one else seems to. Credibility is key, young grasshopper.

I somehow doubt theres an "official" definition and "requirements book" for the term Operating System
PonyKuu #25
Posted 28 March 2013 - 08:30 AM
Cranium, the main question was, what is the point? For fun? That's indeed acceptable, but is there some conditions when you need to write such a huge piece of complex code for practical usage?
MysticT #26
Posted 28 March 2013 - 08:59 AM
Cranium, the main question was, what is the point? For fun? That's indeed acceptable, but is there some conditions when you need to write such a huge piece of complex code for practical usage?
Well, I do it for fun more than anything (I think all of us are here for that, this is a game after all :P/>). But the idea is to provide an environment that helps the user in whatever he wants to do. This can be anything like having an easy to use shell (in this case, most people won't consider it an OS if there's nothing more than that), some apis to help you make programs easier, adding multitasking, etc.
So, the os is essentially the interface between the user or the user programs and the computer.

Things that are NOT Operating Systems:
A startup program that just shows a loading screen with some text (this is not even usefull).
A collection of programs/apis. They are just that, a collection/pack of programs or apis, no matter how good or usefull they are.

This is different from real life OS's, but CC computers are different from real computers, so why should they be the same?

This is just my opinion, and I would like to hear if someone has a different one.
Cranium #27
Posted 28 March 2013 - 02:43 PM
I think that for something to be considered a true CC OS, it has to handle things with the peripherals and the input/output in a different way than is currently in CraftOS. If you were to write a new protocol for computers to talk over rednet, while sharing files, and being able to do so in the background, it would be nice. This is one thing you can do to make an OS of your own. Make something that drastically changes the way that all of this is handled. This would of course mean a rewrite of almost everything in CraftOS, but that's the point.
oeed #28
Posted 28 March 2013 - 03:18 PM
Based on what you have said, Cranium, removing CraftOS would essentially be a Lua promt. Therefore, as most 'OS'es don't use Shell programs, one could say that a ComputerCraft OS, is technically and 'OS'. Now, there are some better examples that others. I would consider anything that is not part of the editable APIs part of CraftOS (the colours api, for example). In terms of hardware, in our case peripherals, that is (base on my deffinition) bios managed. Therefore, most of the 'OS'es do manage their hardware.
Mailmanq! #29
Posted 28 March 2013 - 03:36 PM
Can we just let people make the 'OS'es and let me feel stupid because they are way smarter than me and made something cool? I don't really care if the name suits it or not. For example, lets take PearOS, because it looks cool, PearOS sounds way better than Pear Fancy Program Runner n' Things. Actually the latter sounds pretty cool, but anyway it doesn't matter the name. A computer craft computer as MysticT said are way different from real computers, so why treat them as so. The idea of an OS is drastic changes to how things are done in ComputerCraft, generally on the input side though. Input, is very crucial… oh wait, I started rambling on again.
Cranium #30
Posted 28 March 2013 - 03:44 PM
Based on what you have said, Cranium, removing CraftOS would essentially be a Lua promt. Therefore, as most 'OS'es don't use Shell programs, one could say that a ComputerCraft OS, is technically and 'OS'. Now, there are some better examples that others. I would consider anything that is not part of the editable APIs part of CraftOS (the colours api, for example). In terms of hardware, in our case peripherals, that is (base on my deffinition) bios managed. Therefore, most of the 'OS'es do manage their hardware.
Not so! I mean that if you took away the everything, you can still rewrite the entire OS to your liking. You can build the system from the ground up. The only limitation you would have is the sandbox that ComputerCraft is written into with the Java code. You can get rid of all of the programs in ROM, and you are only left with the open sandbox that is available through java. Many of the APIs in ComputerCraft aren't even necessary for its basic functionality.
Imagine³ #31
Posted 29 March 2013 - 01:59 AM
Can I ask why you said "not only for linux"
gamax92 #32
Posted 31 March 2013 - 06:08 AM
People tend to think that linux is the only os that has a kernel and that one is not needed. Yet many OS have a kernel, Linux, OS/2, Windows, Windows 3.11 even, MSDOS, etc. They all have kernels.

Also, I'm restoring the original post. A majority of the post has been restored thanks to the quotes and Google Cache.
—-
Oh and btw, CraftOS is the bios.lua, its not /rom/programs/shell.

Taking off the /rom/programs/shell only leads to the shell api being missing.
Removing bios.lua makes us loose all the patched Lua api's but we still have the api's from LuaJ
We still have Term api, Fs api, Redstone api, Peripheral api, Os API, HTTP api, and the BIT api because all of those are written in the java side of ComputerCraft.

Without CraftOS which is bios.lua, we still have a bunch of things to work with.

I'm not saying "To make an operating system, you need to make your own bios.lua" but you can take over the majority of CraftOS and manage it like it is the hardware.
Infact if you really wanted to, you can exploit your way into the bios to take over, but thats a different story.
Unit158 #33
Posted 01 April 2013 - 09:09 AM
http://wiki.osdev.org/Expanded_Main_Page

Some things on here should help explain how to make a good operating system. I know it is for actual computers, but the design knowledge and most of the principles can still be applied to computercraft.
Kilobyte #34
Posted 06 April 2013 - 02:56 AM
Another note:
On a cosole based computer you usually have these components:
1. BIOS
[indent=1]The bios is hardcoded and does stuff like the self-test or looking for bootable medias. In CC this is represented by The Java Part.[/indent]
2. The Bootloader.
[indent=1]Its usually located in the MBR of the first partition of the First Harddrive, Its loaded by the bios. Its tasks are to actually launch the kernel.possibly after asking the user to select one. In CC This is part of the BIOS.lua[/indent]
3. The Kernel
[indent=1]The kernel loads modules and drivers, then provides an interface for applications while restricting their rights (more or less). if the OS supports Multitasking it also distributes recources over the different processes/threads. This is again part of bios.lua for cc[/indent]
4. The Shell
[indent=1]The shell is just a regular program, usually running with same permissions as any other program. its task is to give the user an interface so he can actually work with the computer. on linux this usually is /bin/bash or /bin/sh by default, for cc its /rom/programs/shell. The shell itself is no part of the OS.[/indent]

An OS is not just an API/library. at the same time its not just a program. An OS usually runs in the background all time, with more or less stuff to do. (even in CC theres always a task in the background: rednet.run() it manages the modem <-> rednet api mapping.

I hope this was helpful. (yes, lots of redundand stuff, but i think its a more clear definition)
FuuuAInfiniteLoop(F.A.I.L) #35
Posted 15 April 2013 - 12:31 PM
One thing more to add: Kill CraftOS or you are not a real OS

http://www.computercraft.info/forums2/index.php?/topic/5651-top-level-coroutine-override/page__pid__110382__st__40#entry110382