I want to make a low memory OS

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
OS-Bones

Re:I want to make a low memory OS

Post by OS-Bones »

Code Slasher wrote: hi, I suggest you then read up on os theories and dev. then learn the architecture you want to dev for,most of us dev for the x86 family of computers. if you are also doing x86 development then read the intel docs.a search on intel 386 manual will get you the 3 volumes. hope this helps
Still kinda complex.
Just start with the basics.

How do I program a computer?
What do I need to program a computer?
What should I start with?

Anserw these questions simplisticly.
(I'm sorry if I'm diffuicult but I really don't know)
Schol-R-LEA

Re:I want to make a low memory OS

Post by Schol-R-LEA »

OS-Bones wrote: This is too much information.
Keep it simple and tell me where to start on making my OS.
I'm a complete newbie and I don't know what you're talking about half the time.
OK, let's start with a few questions to you:

EDIT: This is what comes of getting interrupted in the middle of posting. Feel free to ignore these questions, as your last message more or less answered most of them.

[*]What programming languages do you know, and what kind of programming have you done in the past? Are you familiar with the fundemental concepts of algorithms, data structures, optimization, etc.?

[*]What operating systems have you used in the past?

[*]How much do you know about how OSes work (process scheduling, memory management, filesystems, interprocess communication, etc.)?

[*] Have you read the FAQ or the .:Quicklinks:. page yet?

[*]Why do you want to write an OS (any answer is acceptable, but it would help us understand your problems if we knew your purpose)? It sounds as if you have a particular goal in mind; why do you need a whole new operating system to achieve it?

[*]What kind if computer do you have? In particular, is it a 386 CPU model or later? How much hard drive space is there on it?

Sorry to give you the third dregree like this, but it seems that we've been talking past each other, and I think that we need to find some common ground. HTH.
Schol-R-LEA

Learn to Program, In Theory

Post by Schol-R-LEA »

OS-Bones wrote: How do I program a computer?
What do I need to program a computer?
What should I start with?
That's a rather tall order, I'm afraid. There are many different programming languages, styles of programming, and ways to learn how to program.

Ordinarily, I'd reccomend starting off with the 'Advice to Novice Programmers' thread on the General Programming forum, but it sounds like even that may have too many assumptions behind it.

So, to begin very simply: Programming consists of writing a list of instructions for the computer to follow, and defining the data which it will work on. It can get a lot more complex than that simple description implies, but that in a nutshell is what programming is.

Programs are all written in special languages which are designed to describe these instructions in a very clear and unambiguous manner, so that another program can translate them for the computer. Each programming language has a different model of how programs work: some model them as a list of instructions to be run one after another (Fortran, older Basics), some model them after mathematical functions (LISP, APL) or real-world objects (Smalltalk, C++), but most model them after a sort of list of instructions that has been grouped into paragraphs or blocks of related actions (Pascal, C). Learning how to program involves learning how to express what the program should do in one or more of these languages.

The written form of a program in a programming language is called source code; the act of writing a program is called coding. Even the simplest programming languages are very complex, and you will almost certainly need some kind of beginner's guide book when learning your first few languages; as you learn languages, it becomes easier to pick up even more of them.

Learning how to write code in a programming language is only one part of programming. You must also learn how to plan and organize the instructions in a meaningful manner. A basic logical plan for how to perform a given action is called an algorithm; it is possible to express most algorithms in any programming language, but each language would express a given algorithm in a different way. Each language has it's advantages and disadvantages for expressing various kinds of algorithms. As the programs you write become more ambitious, you may want to learn how to use sophisticated planning tools like CRC cards or Unified Method.

In addition to expressing the instructions, most programming languages also require you to define how the data they need to work on is to be organized. Managing data structures is equally as important as algorithmics, if not more so.

In order to run a program, the source code first has to be translated into a form the computer can use. The two major types of translators are compilers, which conver the whole program into machine operations all at once and save them so that they don't have to be translated over again; and interpreters, which read each line of a program as it is running and perform the operation themselves for the program that is being translated. While most languages can in principle be either compiled or interpreted, most languages use either one or the other, but not both. In order to run a program that you have written, you would need the appropriate translator for that language.

For most languages, you will need a text editor that can save files as plain text with no formatting. Fortunately, most translators have a built in text editor that is specifically designed for the language; such a combination is called an Integrated Development Environment, or IDE.
Schol-R-LEA

Learning to Program, in Practice

Post by Schol-R-LEA »

Now, to get down to some specifics:

As a warmup before doing anything else, go read the Jargon File until it starts making sense. That will get you in the right state of mind. Don't get bent out of shape by ESR's liberal use of the word 'hacker', BTW; he doesn't mean it the way you probably think he does. The following entries are of notable interest:
ASCII
BNF
Bubble Sort
boot
C
deep magic
fencepost error
grok
hack mode
LISP
operating system
Perl
zen

Appendix A is also a good source of insights, especially the AI Koans and The Story of Mel. Do You Believe That?[sup][size=-4]TM[/size][/sup]

Then, start by learning HTML markup before trying any programming. HTML shares a lot of the same kind of organizational qualities of programming languages, but is much simpler, and the results can be seen on an web browser.

After that, I'd download a copy of DR Scheme, a Scheme interpreter designed to be easy for novices to use. I would then read How to Design Programs, a beginner's programming book written specifically for Dr Scheme. The book (which can be read on line if you cannot afford to purchase it), explains very carefully how to use Dr Scheme for programming.

I hope this helps. You may want to try posting to the General Programming forum for any further assistance.
OS-Bones

Re:I want to make a low memory OS

Post by OS-Bones »

Schol-R-LEA wrote:
OS-Bones wrote: This is too much information.
Keep it simple and tell me where to start on making my OS.
I'm a complete newbie and I don't know what you're talking about half the time.
OK, let's start with a few questions to you:

EDIT: This is what comes of getting interrupted in the middle of posting. Feel free to ignore these questions, as your last message more or less answered most of them.

[*]What programming languages do you know, and what kind of programming have you done in the past? Are you familiar with the fundemental concepts of algorithms, data structures, optimization, etc.?

[*]What operating systems have you used in the past?

[*]How much do you know about how OSes work (process scheduling, memory management, filesystems, interprocess communication, etc.)?

[*] Have you read the FAQ or the .:Quicklinks:. page yet?

[*]Why do you want to write an OS (any answer is acceptable, but it would help us understand your problems if we knew your purpose)? It sounds as if you have a particular goal in mind; why do you need a whole new operating system to achieve it?

[*]What kind if computer do you have? In particular, is it a 386 CPU model or later? How much hard drive space is there on it?

Sorry to give you the third dregree like this, but it seems that we've been talking past each other, and I think that we need to find some common ground. HTH.
Here are your anserws:

I know some Java Script, some BASIC, and I am quite fluent in HTML.

In the past I have used Windows and occasionally a Mac.

As far as I know an OS is a collection of Files and programs connected to form a user freindly way to control them.

Some parts of them.

I want to write my OS for a fun project and also to develope a few skills for my resume.

Not fully sure about my programming computer other than it has 6 gigs. of hard drive space and its running Windows 98. The computer I'll be running my OS on is an IBM Personal System/2 model 50 with 20 megabytes of space.

Its alright to give me the third degree as long as it helps in the end. I really am a rookie.

I'm only 12 years old and in Grade 8!
Tim

Re:I want to make a low memory OS

Post by Tim »

I want to write my OS for a fun project and also to develope a few skills for my resume.
...
I'm only 12 years old and in Grade 8!
Whoa... Forget about any resume for ten years. That's taking it far too seriously.

Also, if you start getting into OS development heavily, you'll miss out on your teenage years. Get your priorities right.
OS-Bones

Re:I want to make a low memory OS

Post by OS-Bones »

Tim Robinson wrote:
I want to write my OS for a fun project and also to develope a few skills for my resume.
...
I'm only 12 years old and in Grade 8!
Whoa... Forget about any resume for ten years. That's taking it far too seriously.

Also, if you start getting into OS development heavily, you'll miss out on your teenage years. Get your priorities right.
I have my priorities straight.
I'm a bit of a pre-planner I know.
And it's not only a good resume I'm after its that, at my school everone else is good a sports and has lots of freinds so I get picked on, I wanna prove to them I'm not worthless.
Besides the "teenage years" are based on yelling at your parents and alot of other bad stuff I don't wanna get mixed up in.
So just help me please.
User avatar
Candy
Member
Member
Posts: 3882
Joined: Tue Oct 17, 2006 11:33 pm
Location: Eindhoven

Re:I want to make a low memory OS

Post by Candy »

OS-Bones wrote:
Tim Robinson wrote:
I want to write my OS for a fun project and also to develope a few skills for my resume.
...
I'm only 12 years old and in Grade 8!
Whoa... Forget about any resume for ten years. That's taking it far too seriously.

Also, if you start getting into OS development heavily, you'll miss out on your teenage years. Get your priorities right.
I have my priorities straight.
I'm a bit of a pre-planner I know.
And it's not only a good resume I'm after its that, at my school everone else is good a sports and has lots of freinds so I get picked on, I wanna prove to them I'm not worthless.
Besides the "teenage years" are based on yelling at your parents and alot of other bad stuff I don't wanna get mixed up in.
So just help me please.
after reading up on this thread I kind of feel like you're on the exact same path as me a number of years ago.

As an advice to what you might want to do before beginning OS development, as sort of an exercise, and also as a short history of myself...


Don't start on making your own operating system. If you start now you'll only create an exact copy of a different OS (linux? windows?) or fail horribly (a lot of other projects?)

First of all, make sure you have the knowledge to make an OS. Start seeking all over the net for all intricacies of every bit of the type of computer you want to support (IBM PS/2 is x86). Select a number of specific devices you want to support, make sure that they are pretty new, and that you can access and afford them in the upcoming X years.

Tune your programming skills in basic, then, as a way to learn new ways of thinking, try to extend basic to do some very complex feature it cannot do now (assuming you use qbasic or qb45), such as using the full capabilities (as in, VESA) of a video card, using the lowlevel functionality in reading a harddisk to offer support for a new filesystem and stuff like that. In short, try to extend it using some functions it didn't support before.

After that, learn some new languages in full, for instance, C, Java or C++. I can recommend learning C, because with a certain degree of certainty I can tell you it's the one you're going to like (and use). Also, learn how to do assembly programming on the machines you're targeting, including the exact relation between ones and zeroes, and the assembly code.

Knowing the languages to make an OS, all you need now is a design to work out. If you want to go the easy way, take an existing design (public such as POSIX (unix) is easiest, but you can also attempt to make a new Windows) and make working code that realises that design. However, making an existing design calls for the obvious question: why don't you use the other implementation of the design? If you cannot give a better explanation than financial or idealistical reasons you should look at making a new environment for that kernel.

If, however, you decide you have a better explanation, or you want to make your own OS design (and kernel design), you need to read up on techniques and methods to actually implement the design, and how to work out the specifics. You can search on the internet for all the bits you need, they're there, but it's a lot easier to get one or more books (ask them for your birthday, it worked with me :)) and use the information in them. I can recommend Tanenbaum - Modern Operating Systems for the theory and Hans-Peter Messmer - The Indispensable PC Hardware Book, more are in the book references in one of the sticky threads.

If you have an OS design, all details worked out and you know the languages, you should also be ahead a couple of years. Now you can start to implement it. Do so bit by bit, and test every bit, because that allows the easiest debugging. If something doesn't work at that stage, come here for more assistance, we're about at that point too.

PS: I would recommend trying to get some friends that do trust you, even if it is on this forum. Growing up without friends is a really shitty thing to do, I did so and I can tell you that you don't want that. If necessary, add my msn for any additional help ([email protected]).

HTH, Candy
Schol-R-LEA

Re:I want to make a low memory OS

Post by Schol-R-LEA »

OS-Bones wrote:I have my priorities straight.
I'm a bit of a pre-planner I know.
And it's not only a good resume I'm after its that, at my school everone else is good a sports and has lots of freinds so I get picked on, I wanna prove to them I'm not worthless.
I could give you all kinds of reasons why that won't work, but I think that uber-geek and LISP guru Paul Graham said it a lot better than I could, in his essay "Why Nerds are Unpopular". Once you realize that your playing a different game than the others, you can do something about it - either by changing directions (if you really want to, which I doubt you will), or else by sticking to your guns and laughing at what fools we mortals be fnord.

(BTW, if you ever want to really raise some hell, print out a couple dozen copies of this essay and hand them out to the students and teachers at school. Shake the bastards up a bit. All Hail Discordia!)

My only real problem with Graham's analysis is that he is too dismissive of the impact this has on the adult world fnord; having spent most of his own life in the lofty heights of think tanks and small startups, he seems to have missed the pervasiveness of such social stratification elsewhere in society. The same zero-sum game of oneupmanship can be seen in large bureaucracies fnord, or among the middle-management of major corporations fnord; the same kind of pandering and cajoling needed to appease the Alpha Males in school, is also necessary to deal with Vulture Capitalists and other power brokers fnord. The only difference is that the game is now played for much higher stakes, and those who don't play it well end up at the mercy of those whose main skill is manipulating others.
Besides the "teenage years" are based on yelling at your parents and alot of other bad stuff I don't wanna get mixed up in.
If you think that, then you really don't have your head together about it. First off, if you have any thoughts of your own at all, you'll pretty soon find reasons to get into conflict with your parents; after all, neither you nor they are perfect, and no two people ever completely agree on everything. As for 'other bad stuff', much of it is 'bad' only by the judgement of arrogant fools who you are better off ignoring fnord.

I am not saying that the 'teen years' are going to be great; in fact, in this era, I can pretty much guarantee that they will suck hard for anyone who isn't hopelessly shallow (and despite appearances, there are not very many teens like that - most are just better at pretending to be, to keep their status among the shiny happys). But trust me, actively avoiding the world your stuck in will only make your life much worse fnord. I have been there, and if I had a chance to do it all over again, I'd Play The Game fnord instead of burying myself in books; one of the worst shocks of my adult life was when I realized that the social games that I found so absurd as a boy were not merely the most important thing in life, they were the only things that mattered. I don't mean the particular games, mind you - those really are as petty as they seem - but the ability to play the game effectively. If you can't play the social game with confidence, then you will be screwed forever, and no amount of genius will save you from it.

However, I advise maintaining a certain amount of cynicism about it. Always remember that no matter how important the crises you're facing seem now, they will pass soon enough. Taking them too seriously is just as bad as trying to pretend they don't exist. And for Goddess' sake, don't forget to have fun, what ever your definition 'fun' may be.

If my advice seems messy, inconsistent and illogical, that is only because the reality they reflect is itself messy, inconsistent and illogical. The world isn't arranged for our convenience, and the more you try to impose Order fnord upon it, the more Chaos will be the result fnord.

Of course, you may decide I am one of those fools to be ignored. Nothing wrong with that; I'd rather have someone honestly disagreeing with me than pretending to agree just for the sake of keeping the peace fnord. I've said what I wanted to say; whether you listen to it or not is your business fnord.

(Though in the end fnord, 'fnord' itself is just an allegory for precisely the sort of screwed up 'social adjustment' we've been discussing fnord. Then again, so is everything else in life fnord. Hail Eris!)
Schol-R-LEA

Re:I want to make a low memory OS

Post by Schol-R-LEA »

One more note; if you want to do something that will get the admiration of the Alphas, take up either a martial art, or a solitary sport like running or rock climbing, and get really good at it. Such pursuits are more likely to be tolerable than team sports are, and they still giving you plenty of time to think. A martial artist who can hold his own on the schoolground against the bullies will get some grudging respect, while a successful competitive runner will be seen as being 'an asset to the school'. Just something to consider.

Sadly, just about any excercise in brain power that doesn't also make you rich and/or famous is likely to make things worse for you, not better. In high school, being a high profile nerd is nothing more than a bigger target for those looking to push you down.
OS-Bones

Re:I want to make a low memory OS

Post by OS-Bones »

I'm sorry but why are you people preaching to me?
I didn't come here for help with my life, I can handle my life. What I need is help building my OS.
I'm sorry but its the truth.
Slasher

Re:I want to make a low memory OS

Post by Slasher »

When you get older you'll understand!
Curufir

Re:I want to make a low memory OS

Post by Curufir »

Ok, no preaching ;).

Do you actually know anything about programming?

I'm not trying to be condescending, but you mention that you don't know what C is (Aside from it being a programming language) and pretty much every programmer on earth knows at least some C.

Compared to practically every other software project you'll ever meet OS programming is very, very difficult to do well.

It is not the place to start your programming career, no matter how precocious you may be. A programmer needs a certain level of mental toolkit to approach OS development, without which the whole experience just becomes an exercise in frustration.

Start smaller. Write some demos (Which is a nice scene to get into if you can), maybe some games. My personal advice would be to see if you can get a coding position on a MUD (Or start your own) because most use LPC to program with (Which is very similar to C) and have experienced coders around to help out newbie wizards (As well as having a social aspect...oops, no preaching ;D).

If you were learning piano you wouldn't expect to be able to play Rachmaninov's concerto number 3 the first time you sat down at the instrument, no matter how talented you might naturally be at piano. For exactly the same reasons you shouldn't tackle an operating system as your first major software project.

Feel free to ignore that advice if you so choose. I just don't want to see someone turned off programming (Which is a stimulating and rewarding hobby) because they overstretched themself when starting out.
BoomSukka

Re:I want to make a low memory OS

Post by BoomSukka »

Okay Curufir, I have to say that Rachmaninov was a really good example.

Play piano much?

;)

(I spent two weeks on Moonlight Sonata -- as easy as it sounded, was still WAY harder than, umm, let's say pmode + GDT + IDT + paging)
Schol-R-LEA

Re:I want to make a low memory OS

Post by Schol-R-LEA »

OS-Bones wrote: I'm sorry but why are you people preaching to me?
I didn't come here for help with my life, I can handle my life. What I need is help building my OS.
I'm sorry but its the truth.
Very well, I apologize for having overstepped the boundaries with that last set of postings (though I do hope that you at least gave them some thought). As for help with your OS, All you need do is ask.

I would still recommend learning Scheme using Dr Scheme and the online version of How to Design Programs, and here's the reason why: Scheme is a very simple language to learn, as programming languages go, which means that unlike most books on learning how to program, HTDP is free to focus more on the principles and techniques of programming in general without getting bogged down in the details of the language. You can dig into serious programming topics much faster that way that you would starting out in, say, C. It will be a while before you know enough programming to start seriously working on an OS; if you start in Scheme with a fast-paced book like HTDP or Structure and Interpretation of Computer Programs (the classic MIT freshman programming text, also available online), you will get there a good deal faster, and understand things much better as well.

Also, Scheme has a very different perspective on programming than most other languages; while that may sound like a disadvantage to some people, it actually means that if you learn Scheme first and then move on to a language like C, you will have a broader sense of how programming works than you would if you just learned one language and stuck to it.

Finally, there is a general consensus that the more languages you know, the easier it is to learn new ones. If you learn a few other languages first before mastering C, then you will probably spend less time over all than if you just learned C alone (Scheme, Smalltalk, Python, and Perl are the ones I recommend, in roughly that order).

Beyond that, you are going to have to learn assembly language as well. There's no way around this: if you mean to write an OS, you'll need to do some assembly programming, and the better you understand it, the fewer problems you'll have. Also, assembly programming is very insightful for other types of programming, for the opposite reason than Scheme is: whereas Scheme is almost completely abstract, allows you to think in terms of functions and lists, assembly programming forces you to watch every minute detail of how the system is running at the very lowest of levels.

The best book I know of for assembly programming is Assembly Programming Step by Step by Jeff Duntemann; it is a good enough book that it could easily be your first book on programming, instead of HTDP. WHile it is not freely available online like HTDP is, it is well worth the price to buy it, and it can be found in many bookstores. The combination of the two course of study should leave you with a solid vision of what programming is about (once your head stops spinning).
Post Reply