The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Wednesday, Debtember 08, 1999

Fastest Proprietary 80x86 Based Operating System

So the Slashdot crowd are raning about this new operating system called V2 OS. Since one of my many little hobbies is collecting and critiquing homebrew/alternative operating systems, I decided to give this one a try.

It seems that you can only get a binary so I can't comment on the code quality (all 80x86 Assembly code of course) but I did try to boot it. I have a spare 486 that normally runs a network monitor I wrote (one of these days I'll get around to releasing it) but hey, it's a PC and it'll spare me the trouble of rebooting my main system.

System16 code is now in control.
ERROR: Failed to retieve [sic] information on the bootdisk...[1]
Creating PartitionList.
ERROR: Failed to retieve [sic] information on the bootdisk...[4]

[sic]'s are mine

Can't quite understand why it failed. Linux boots fine from floppy on this system. The only unusual thing about the system (other than it being a Compaq 486) is the lack of a harddrive (I actually use a modified tomsrtbt distribution—it's a nice single disk Linux distribution that makes a very good rescue disk for PCs). Everything else on the system is pretty much vanilla PC.

The last “Fastest Proprietary 80x86 Based Operating System” they featured at least came with source code. A good thing because it's long gone. All the links I have to it are no longer valid. I wonder how long this one will last?


For those of you who are interested in rolling your own operating system, and if you insist on writing it all in Assembly on your typical IBM PCompatible (and the most popular type is your 32-bit multitasking operating system) please, please, do yourself a favor—avoid using CLI and STI as locking primitives. It fails miserably on SMP-based machines (which I predict will become a commoditized item, much like older 486 and early Pentium machines are now, in the next five years).

Better to use the following:

lock_for_here	db	0

	; code code code 

		mov	al,1
.spin		xchg	al,[lock_for_here]
		cmp	al,0
		jne	.spin

	; critical code here ...

		mov	byte ptr [lock_for_here],0

This actually has several advantages over using CLI and STI:

  1. XCHG locks the bus so that the exchange is atomic with respect to other CPUs on the bus.
  2. XCHG is not a protected mode instruction, unlike CLI and STI—therefore the sequence can even be used in non-priviledged code. While this may seem silly when you're writing a kernel, not every CPU has a duo user/superuser model. The 80x86 line does support four different priviledged modes.
  3. Interrupts can still be serviced.
  4. It doesn't hurt that much on a single-CPU system if it's programmed properly. Sure, the worst case is a deadlocked system, but you're careful to avoid deadlocks, right?

Better yet, wrap them up into functions. That case, if you do need to change how to lock critical sections (say if CLI/STI does prove faster for a single CPU system) you can easily change it in one location.

And it makes it just that much easier to port.

Obligatory Picture

[“I am NOT a number, I am … a Q-CODE!”]

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site:, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.