OS Development #1

posted in Journal #259850
Published November 25, 2005
Advertisement
It's official. This journal's no more titled "Rarely updated". I still don't know what to name it, though, so I'll leave it at '...' temporarily. If you've got any smart suggestions that fulfill the following criteria (yes, you, Jack), feel free to drop me a message:
1.Totally uncool.
2.Totally unoriginal.

I'm basically looking for the journal title equivalent of what "Muhammad Haggag" is in terms of a user name (compared to "Coder"). Something that doesn't imply anything.

NOTE: I felt very strange writing this entry. I usually never speak up my mind, ever, let alone write about it in public. I developed this habit because of a generally high retardation coefficient in my surrounding environment, which taught me to keep my pie-hole shut the hard-way. Hopefully, better minds do exist, and they're going to expose whatever weaknesses there are in my plans to conquer teh univarse!

Now, on the to the meat of the entry. As you may already know, I'm a senior Computer Engineering student at a retarded University. When graduation project proposals were due, I proposed writing an Arabic x86 Operating System. The goals for such a project are not to produce some readily viable alternative to modern OS's (Ha!), but rather:
1) Learn what it takes to make an OS
2) Establish a framework upon which successor students can build and experiment
3) Experiment with various modern OS designs and problem solutions

While point #1 might not seem that big of a deal, it's actually quite important from a local point of view. And by local, I mean the Arab world in general, and Egypt specifically. The majority of programmers here suck, no way around it. Dang, we suck at almost everything, but that's a rather painful subject and I'd rather not open it up now. Back to software. There's no common knowledge base or human expertise in almost all software fields except Enterprise application software, and even there they moderately to genuinely suck. This has lead to a sad situation where people blindly think certain things are impossible, and don't even bother reading up on them, let alone trying creating them.

My colleagues consider writing a simple OS a monumental task. A teaching assistant even said he'd consider it a huge success if we just wrote something that booted and output a single character to the screen! That's downright humiliating. So, hopefully this will break some of the barriers people here have put around themselves.

#2 is an extension of point #1. I hope to provide a modern, micro-kernel based, modular, well-written, easy-to-understand and extend OS.

MINIX3 naturally comes to mind from the previous description, and indeed I use it for reference. My impression of it so far is that it's well-modularized, but kinda falls on the code-clarity part. Why?

C.

Antiquated C, at that.

I know some people swear by C and all, but I don't, and I don't care. I won't try to write a long justification either, because it's useless. Suffice it to say that I don't like being forced to code in a specific paradigm. Options are good.

As for the antiquation part, I mean things like this:
/*===========================================================================* *				deadlock				     *  *===========================================================================*/PRIVATE int deadlock(function, cp, src_dst) int function;					/* trap number */register struct proc *cp;			/* pointer to caller */register int src_dst;				/* src or dst process */{/* Check for deadlock. This can happen if 'caller_ptr' and 'src_dst' have * a cyclic dependency of blocking send and receive calls. The only cyclic  * depency that is not fatal is if the caller and target directly SEND(REC) * and RECEIVE to each other. If a deadlock is found, the group size is  * returned. Otherwise zero is returned.  */  register struct proc *xp;			/* process pointer */  int group_size = 1;				/* start with only caller */  int trap_flags;  while (src_dst != ANY) { 			/* check while process nr */      xp = proc_addr(src_dst);			/* follow chain of processes */      group_size ++;				/* extra process in group */      /* Check whether the last process in the chain has a depency. If it        * has not, the cycle cannot be closed and we are done.       */      if (xp->p_rts_flags & RECEIVING) {	/* xp has dependency */          src_dst = xp->p_getfrom;		/* get xp's source */      } else if (xp->p_rts_flags & SENDING) {	/* xp has dependency */          src_dst = xp->p_sendto;		/* get xp's destination */      } else {	  return(0);				/* not a deadlock */      }      /* Now check if there is a cyclic dependency. For group sizes of two,         * a combination of SEND(REC) and RECEIVE is not fatal. Larger groups       * or other combinations indicate a deadlock.         */      if (src_dst == proc_nr(cp)) {		/* possible deadlock */	  if (group_size == 2) {		/* caller and src_dst */	      /* The function number is magically converted to flags. */	      if ((xp->p_rts_flags ^ (function << 2)) & SENDING) { 	          return(0);			/* not a deadlock */	      }	  }          return(group_size);			/* deadlock found */      }  }  return(0);					/* not a deadlock */}


Old-style parameter definition, pre-C99 variable definition (at beginning of scope), short header and variable names. Not my cup of tea.

Back to the goals. #3, unfortunately, is more of a "bonus" goal. It's not really a requirement given the limited time we have to create a working OS from the ground-up. I really wanted (and still want) to play with things like Orthogonal persistence, but I don't think we'll have the time to do it. I'd love to experiment with a database-powered, meta-data centered file-system. As someone said, "the possibilities are endless". Unfortunately, time isn't, as far as the faculty's concerned. However, I'm decided on continuing development after graduation. This is already my "pet" project [smile]

One of the core goals, which is kind of a subset of #3, is moving towards full Unicode support. While native English speakers might think already existing OS's do that, they don't do it uniformly or consistently, to the best of my knowledge. In Windows, shells don't support Unicode. They use lame code-pages. On *nix shells, you typically don't get Unicode support UNLESS you're running on an X variant. And even then, you don't get real support (e.g. BiDi).

Luckily, this doesn't involve much work. Building on Unicode from day 1 means you're 90% there. What we're planning to do is simply doing console mode with VBE. i.e. A graphics mode with a BiDi-aware text renderer. I've already written one before for the Palm, and it's not much of a big deal. With Arabic, that is. Rendering languages like Japenese and Chinese is out of scope for now. VBE is supported by all modern hardware, so we shouldn't be getting hardware problems.

During my recent productivity surge, I've been coding all day (Something I haven't done for months!). While most of the time I was working on the DirectX samples, I've spent quite some time on the OS. We use legacy GRUB (0.95) for booting, so we got booting (an otherwise VERY tedious process) out of the way quickly. We currently have a basic functional VGA text-mode driver, a working interrupt handling system, a working PIT (Programmable Interrupt Timer) module, and a working but not full-featured keyboard module.

I was going to write a bit about the problems encountered throughout development so far, but I'd rather do that another time, seeing how large this entry has become. I'd still love to vent off a bit by saying that keyboards are COMPLETELY RETARDED. They are THE SUCK, truly. That, and backwards compatibility is the root of all evil.

Muhammad out.
Previous Entry Another Direct3D sample
Next Entry The n00b
0 likes 3 comments

Comments

Washu
Thief.

On the subject of writing operating systems: Heh, getting a character up onto the screen is rediculously easy :P
November 25, 2005 01:09 PM
jollyjeffers
So, in the last entry I commented on how you've updated in one month almost as many times as the whole year. Now you've gone and created a single entry that's almost as big as a whole month's worth [lol]

Quote:If you've got any smart suggestions that fulfill the following criteria (yes, you, Jack)

* puts thinking cap on *

It's gotta be something to express the amazing brain power that you command. Possibly something to do with your constant threats of jumping through windows and doing nasty things to people while they're sleeping (that was a joke, right?).

Maybe:

"The amazingly awesome"
"The amazingly retarded"
... Muhammad Haggag (added by the journal software)

Quote:I usually never speak up my mind, ever, let alone write about it in public.
So what was all that ranting about retardedness and various Linux distributions? [smile]

Quote:I proposed writing an Arabic x86 Operating System.
I'm impressed already. Honestly. Maybe you have more time to do such a project than I have - but for time constraints if nothing else I couldn't consider something like that!

Quote:he'd consider it a huge success if we just wrote something that booted and output a single character to the screen! That's downright humiliating.
Output THREE characters. That'll show them [wink]


Sounds like an ambitious project though, but I'm sure you'll manage it [grin]

Jack
November 25, 2005 01:18 PM
Muhammad Haggag
Quote:Thief.

Is that a journal name suggestion? [grin]
Sounds cool! Which is a little bit the EXACT OPPOSITE of my first constraint, but hey! If it comes from Washu, who am I to reject? [smile]

Quote:So, in the last entry I commented on how you've updated in one month almost as many times as the whole year. Now you've gone and created a single entry that's almost as big as a whole month's worth

I suspect that YOU have somehow managed to DUMP something energizing into my drink.

Quote:It's gotta be something to express the amazing brain power that you command. Possibly something to do with your constant threats of jumping through windows and doing nasty things to people while they're sleeping (that was a joke, right?).

I certainly hope you wash your feet before you sleep tonight, cause I don't like pulling unclean toes. And I pull HARD.

Quote:"The amazingly awesome"
"The amazingly retarded"
... Muhammad Haggag (added by the journal software)

You sure you've not put the LOONEY cap on by mistake? [grin]
Anyway, another couple of fine suggestions we have. How about a cross, like:
"The amazingly retarded Thief"

The problem again is that this is not uncool. How about inverting it? That'd SUCK, which is exactly what I'm looking for. Something along the lines of:
"Neither amazing, nor retarded, nor a thief"?

That's damn awesome, I'll use it for now.

Quote:So what was all that ranting about retardedness and various Linux distributions?

Ah, it's a wee fraction of the truth. In my mind, there are parts 2, 3, 4 and 5. I'll probably get myself to write them soon, God-willing.

Quote:I'm impressed already. Honestly. Maybe you have more time to do such a project than I have - but for time constraints if nothing else I couldn't consider something like that!

Well it all depends on your responsibilities. I've kept a low-profile on work recently (I work part-time, so I can do that if I want) and started organizing my life to reach that goal.

Quote:Output THREE characters. That'll show them

Already done, Sir. Screenies next post, God-willing [smile]
Although, yeah, I assume they'd be totally impressed, given that I've almost implemented the basic features they were considering "major" hurdles in like 3 work-days. [lol]

Quote:Sounds like an ambitious project though, but I'm sure you'll manage it

Thanks for the confidence.

Muhammad out.
November 25, 2005 01:38 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement

Latest Entries

Opera 9 w000000t

1284 views

Damn

1172 views

VBE fun, #2

1280 views

VBE fun

1322 views

French, #1

1407 views

Mult-tasking

1167 views

DirectInput hooking

1053 views

MDX overlay sample

1322 views
Advertisement