|
|
#1 |
|
Program a custom OS?
Is it possible to program my own OS from scratch? Don't tell me that it is a stupid idea or anything. I am just wondering if it is possible and if so, where should I start?
|
|
|
|
0
|
|
|
#2 |
|
Yes you can.
You'll need to start off by learning assembly language for your chosen CPU architecture, so that you are able to program low level device drivers to get something to boot. You'll also need to learn the low level details of PCI, SATA, etc. It's not a small task - learning assembly language alone will take you quite some time. I'd certainly recommend doing this using something like VMware (until you know what you're doing) to contain your efforts to a protected, separate environment from your day to day computer. Low level device programming gives you the power to cause all sorts of data corruption and even hardware problems, if run on physical hardware and you don't know what you're doing.
__________________
MBP (early 2011) - Core i7 2720 2.2ghz, Hires Glossy, 16GB, Seagate Momentus XT 750GB Mac Mini (mid 2007) - Core2 Duo 1.8, 2gb, 320gb 7200 rpm iPhone 4S, iPad 4 |
|
|
|
0
|
|
|
#4 |
|
Depending on why you want to build your own, you might be better to start like NeXT did by farming Open Source and University Research Projects by build out the bones of the OS.
Apple still does this in order to get Low level parts of the OS, generally employing key project staff to ensure they keep moving forward.
__________________
There is no such thing as "Collective Wisdom" [13" MacBookPro 2.7Ghz, 27"Al iMac i7, Black MacBook 13", iPhone 4, iPad] |
|
|
|
0
|
|
|
#5 |
|
The answer is obviously yes. Someone had to do it in the past, otherwise there would be no operating systems. So it can be done again.
|
|
|
|
0
|
|
|
#6 |
|
I wonder if you could use what apple already has for boot code and drivers, and then build from that? I know you couldn't legally, but is it possible?
__________________
Questions? MRoogle it! I support the MacRumors Blood Drive! ![]() MR Scavenger Score: 1 |
|
|
|
0
|
|
|
#7 |
|
Well, given that the core of OS X is darwin, and Darwin is open source, well yes you could, it is even legal. A few people did just that with the PureDarwin and OpenDarwin projects.
I agree it would certainly be a lot easier to start off with something like Darwin or FreeBSD in a virtual machine to play with and modify/break, than trying to start out from scratch without any experience in operating system design. Back in the 80s when an OS wasn't expected to do much (like DOS), writing one from scratch would be a lot easier. I think its an example of just how much work and complexity is involved that it took apple several failed attempts (and they ended up buying NEXT back off Jobs to turn it into OS X) to replace the original Mac OS. IMHO the only reason to write your own quick and dirty "OS" these days is if you want to program the machine to do a single task as quickly as possible. Essentially you're BYPASSING any operating system and doing everything yourself. E.g., many games in the 80s and 90s for stuff like the Amiga, Atari ST, consoles, etc used to do this. Positive: You have no operating system sucking CPU power you could use for your app. Negative: YOU are responsible for all low level device access - no drivers, no graphics libraries, no UI, etc are available. You're on your own. Otherwise (if you want to run other people's software in a multi-tasking environment) writing an efficient scheduler and memory manager is not a trivial task to undertake. Even Windows, Linux, OS X and FreeBSD are having regular changes and tweaks made to improve their schedulers and memory managers, after several decades of real world use and refinement. And that's before you even get to the user interface stuff. Not to poo-poo the idea, it's how Linus started out with Linux, and many others created operating systems before him - but to make anything even remotely comparable to OS X (or even Linux) will take many people a long time, even if they're good, experienced programmers.
__________________
MBP (early 2011) - Core i7 2720 2.2ghz, Hires Glossy, 16GB, Seagate Momentus XT 750GB Mac Mini (mid 2007) - Core2 Duo 1.8, 2gb, 320gb 7200 rpm iPhone 4S, iPad 4 Last edited by throAU; Apr 27, 2012 at 03:01 AM. |
|
|
|
0
|
|
|
#8 |
|
|
2
|
|
|
#9 | |
|
Quote:
As it happens, you can still read some of his conversations with Andrew Tanenbaum on usenet. Tanenbaum is a professor who specialises in teaching OS design. He even built a teaching OS called Minix. The name Linux is a bastardisation of the Minix name, I guess because Linus was studying Minix at the time. So here's my advice to OP: If you want to write an operating system, get Andrew Tanenbaum's books on the subject. They're not easy to read, but if you want to write an OS they're going to be a serious help. If you can't make it to the end of those books, you're probably biting off more than you can chew. |
||
|
|
0
|
|
|
#10 |
|
Yes, it's easier than you think
Yes! You don't have to know Assembly either. You can write an OS in any high level language including Java.
Probably the best place to start would be to take a course on Operating Systems, and if that's not possible, reading a book on Operating Systems. That will give you an idea of what an OS is, and which parts of an OS you want to write. Then you simply write the different parts of the OS. Compile it for your architecture, and away you go. It is easier than you think, and it is a fantastic idea. It gives you a great understanding of computers. |
|
|
|
0
|
|
|
#11 | |
|
Quote:
I'm curious, how does one write an interrupt handler in Java? Or, for that matter, bootstrap the JVM on their OS if their OS is written in Java? |
||
|
|
0
|
|
|
#12 | |
|
Quote:
http://en.wikipedia.org/wiki/Darwin_(operating_system) Here is an Apple support document describing how to obtain and build Darwin. https://developer.apple.com/library/...ild/build.html
__________________
Warren Holybee |
||
|
|
0
|
|
|
#13 |
|
OS in Java? Ha-ha-ha-ha-ha - that's rich!
You cannot write an OS in a high-level language, sorry mrbash, no-can-do.
You can write a GUI that way, on top of Darwin or any of the free UNIX-like kernels. Is that perhaps what you meant? Writing an OS from scratch is a gargantuan task - try picking a small target if you wish to pursue this idea seriously - an 8-bit processor with a small assembler and few device drivers - VDT, keyboard, floppy disk and serial port are a good start. I wrote a DOS for the ZX80 way back in the early 80's, and for one person, it was still a huge task, but very, very educational. Good luck, and keep learning! dmz
|
|
|
|
0
|
|
|
#14 | |
|
Quote:
__________________
20" Aluminum iMac 7,1 (mid-2007, Santa Rosa,) upgraded to 2.6 GHz Penryn, 6 GB RAM, 1 TB HD, 4 TB total external hard drive |
||
|
|
-1
|
|
|
#15 |
|
try taking a look at BareMetalOS, or a small, very small distro of unix... it will require some good knowledge of C, assembly helps too
|
|
|
|
0
|
|
|
#16 |
|
okay, you can do it after learning assembly language.A good book is called "The art of assembly language programming" by Randall Hyde. I wouldn't recommend a high-level language as the abstractions would just cause more occupation of size and memory, and less performance.
__________________
Last edited by adildacoolset; Tomorrow at 09:42 AM. Reason: grammar error |
|
|
|
0
|
|
|
#17 |
|
I suspect most of the people claiming that you cannot write an OS in a high level language do not have a formal education in computer Science. And for those who do, shame on you, you should know better.
A first course in OS will shown that the level of the language does not matter, it is only the logic that you implement that matters. I should also add, that assembly is considered a symbolic language, like object code. The operating system converts Assembly code into machine code, just like the operating system converts object code from a high-level language into machine code. That is to say you can write an OS in assembly, like you can write an OS in object code. I doubt the OP intends to write a commercial OS. Most likely they want to learn some of the core OS concepts like Process, Scheduling and Memory management. Also to answer some of the critics of my suggestion that it is possible to write an OS in Java: Java handles signals (the general case of interrupts) quite well. |
|
|
|
0
|
|
|
#18 | |
|
Quote:
Wrong. The assembler converts assembly instructions to machine code, the cpu can run the machine code natively. Java byte code requires a Java runtime, which in turn requires an operating system where it can be executed, there is your chicken and egg problem as you are writing the operating system there are no Java runtime. Last edited by subsonix; Apr 28, 2012 at 11:09 AM. |
||
|
|
0
|
|
|
#19 |
|
http://en.wikipedia.org/wiki/Lisp_ma...nical_overview
All operating system software was written in Lisp. Xerox used InterLisp. Symbolics, LMI and TI used Lisp Machine Lisp (descendant of MacLisp). With the appearance of Common Lisp, Common Lisp was supported on the Lisp Machines and some system software was ported to Common Lisp or later written in Common Lisp. [underline added] |
|
|
|
0
|
|
|
#20 | |
|
What's your point?
Quote:
|
||
|
|
0
|
|
|
#21 |
|
It was underlined: All operating system software was written in Lisp. Even if it's compiled to machine code, it's still written in Lisp. Or are you arguing that compilers are forbidden?
Did someone at some point have to write assembler? Maybe, maybe not. It's possible there were existing tools that translated Lisp to other forms, such as assembler, and they used that for bootstrapping. So it's quite possible that no person ever wrote any machine code or even assembler. Further fanning the flames, see this regarding Java byte code: http://en.wikipedia.org/wiki/Jazelle I fully realize this is not a complete JVM in hardware, and still requires software support for some byte-codes. |
|
|
|
0
|
|
|
#22 | |
|
Quote:
There's quite a lot of resources available on this if you are interested, I feel this is moving on to the absurd. |
||
|
|
0
|
|
|
#23 | |
|
Quote:
stackoverflow.com: what-languages-are-windows-mac-os-x-and-linux-written-in |
||
|
|
1
|
|
|
#24 | |
|
Re: OS in Java? Ha-ha-ha-ha-ha - that's rich!
Quote:
__________________
Computer Programming: An Introduction for the Scientifically Inclined So how much does an iPhone developer make? My iPhone games: Sjoelen, Mazer (free) |
||
|
|
0
|
|
|
#25 |
|
The kernel is written in assembly though as well as part of the vm, and it uses GRUB as a boot loader.
|
|
|
|
0
|
![]() |
|
| Tags |
| custom, operating system, program |
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 06:43 AM.






I support the 

dmz

Linear Mode
