Bona Fide OS Developer
View unanswered posts | View active topics It is currently Thu Mar 28, 2024 6:28 am



Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3, 4  Next
 i cannot make kernel calls 
Author Message

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post Re: i cannot make kernel calls
Since I have a little background in compiler development I might add a few things here:

Pascal and BASIC are clearly not suited for OSDev'ing, they were not built for systems programming. If you really feel comfortable with them and think there's no way you'll ever be able to learn a real language like C or (better) C++ you should probably go with what you know best. Java and C# (which is 10 times better than Java) are very interesting when it comes to writing operating systems, there's an increased interest in managed code ever since JavaOS (jee, I wonder why Sun dropped that project) and Microsoft's Singularity research project.

A Pascal compiler however really is easier to write. Pascal is a LL(1) grammar while C is a LALR(1) grammar. Unfortunately all my focus was on a C++ compiler and I still curse myself for attempting that as my first compiler project. C++ is hell to parse, take it from me! Well you don't have to take it from me, there's no sane man who would disagree; they all say so :lol: Not many C++ compilers out there anyway.

One important part of my operating system is a dynamic optimizer which works in a dynamic translation-like fashion, except that the host and target architectures are the same (well, pretty much). Application programs are usually written as a collection of loops so if the dynamic optimizer is able to interpret what's outside the loops and optimize what's inside and put that in a cache then we can care less about the overhead. (Even in normal compilation I'm sure you're aware lexing is the most expensive part.) Self-modifying code also works since the original code is never actually played around with, just the code in the cache (which is the one running). Self-modifying code does need re-optimization sometimes, of course. Besides the usual optimizations static compilers and peephole optimizers do my dynamic optimizer can also deal with problems such as languages that enforce late binding (C++/Java, anyone?). Not to mention that some programs are compiled with low optimization flags on purpose (either they take less time to compile or the developer cares about debugging).

Then there's the other thing... Take an x86 for instance. CPUID can tell us the exact model and stepping for a CPU and thus we can make model-specific optimizations based on that (and maybe even avoid bugs in CPUs that applied erratas don't fix or for CPUs that don't support microcodes altogether, such as the infamous F00F bug - of course, there are other ways around that too). Now say a CPU doesn't support SSE2 and the application is compiled to use SSE2 - hey, since we're not natively executing the code we can just take care of that problem and translate it into non-SSE2 code. That means all of a sudden you're able to run high-end applications on low-end processors (you'll just have to be patient with them). The problem gets harder when you want to detect patterns for programs that can take advantage of SSE2 but aren't compiled to. My approach is to try to build SSA trees.

Cheers,
Bogdan


Last edited by Love4Boobies on Wed Oct 14, 2009 1:08 pm, edited 1 time in total.



Wed Oct 14, 2009 12:57 pm
Profile

Joined: Wed Oct 14, 2009 9:39 am
Posts: 198
Location: United States
Post Re: i cannot make kernel calls
I read a whitepaper on the C# OS that Microsoft was doing research on and they had run into an issue with their kernel's design. They noticed that they would have to redesign threading from the ground up due to the way that C# does threading. (If I am not mistaken, the openSharp or w/e the OS in C# that was opensource pulled off the threading, but I also think Microsoft's design was much more complex).

~Charles

_________________
Charles Timko
push %esp ;Musings of a computer addict


Wed Oct 14, 2009 1:03 pm
Profile WWW
Post Re: i cannot make kernel calls
WHAT THE ####!
this topic is not about compilers i have no plan of writing a compiler!!!!!!!


Last edited by Kieran on Thu Oct 15, 2009 1:07 pm, edited 1 time in total.

Bad language



Wed Oct 14, 2009 1:06 pm

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post Re: i cannot make kernel calls
It's not the threads concept that they needed redesigning but IPC and RPC in general. And that was for security reasons since they used no hardware protection domains. They use software transactional memory (as opposed to say, tuple spaces which some Java implementations use or locks, semaphores, monitors and other primitives that other languages use) for shared memory. There's a lot more to it but I'd just end up quoting what you can read from their research papers and developer notes.


Wed Oct 14, 2009 1:12 pm
Profile

Joined: Sat Jul 25, 2009 9:15 am
Posts: 257
Post Re: i cannot make kernel calls
Love4Boobies
you are not following the flow of conversation man... trying to start a flame war with me... implying I don't know C/C++... the only reason I can even program in C# or JAVA is cause I know C/C++...

when you diss PASCAL it shows you don't know diddly... Turbo Pascal was quite admirable... and Delphi is also quite admirable today...

this inability to follow the flow of conversation is usually caused by parralled processors skipping ahead!!!


Wed Oct 14, 2009 2:27 pm
Profile

Joined: Wed Oct 14, 2009 9:39 am
Posts: 198
Location: United States
Post Re: i cannot make kernel calls
ceiling cat iz confuxt...

_________________
Charles Timko
push %esp ;Musings of a computer addict


Wed Oct 14, 2009 5:49 pm
Profile WWW
Post Re: i cannot make kernel calls
do you know how anoying this is
i should kernel call your ass


Wed Oct 14, 2009 6:22 pm
Post Re: i cannot make kernel calls
ok i have calmed down


Wed Oct 14, 2009 9:06 pm

Joined: Sat Jul 25, 2009 9:41 am
Posts: 58
Post Re: i cannot make kernel calls
DudeOfX wrote:
Love4Boobies
you are not following the flow of conversation man... trying to start a flame war with me... implying I don't know C/C++... the only reason I can even program in C# or JAVA is cause I know C/C++...


Woah, I don't think he was implying that at all, only expressing his strong opinion that pascal is a poor choice for os development, not that the language isn't good in other areas.

As for the flow of the conversation ...well expect it to be derailed 3-5 posts in. This IS a forum!

@Boobies Thanks! The book I'm reading now is a good book on theory and example, showing you how to build a full pascal compiler and debugger by the end of it in C++. He says that this isn't the end all book for compiler design (Do I sense red and purple dragons in my future?) but that this was an educational book, and you can then use to better understand those more advanced books that focus on things like optimization!

Thanks!


Thu Oct 15, 2009 12:09 am
Profile

Joined: Sat Jul 25, 2009 11:26 am
Posts: 81
Post Re: i cannot make kernel calls
Arrowofdarkness wrote:
DudeOfX wrote:
Love4Boobies
you are not following the flow of conversation man... trying to start a flame war with me... implying I don't know C/C++... the only reason I can even program in C# or JAVA is cause I know C/C++...


Woah, I don't think he was implying that at all, only expressing his strong opinion that pascal is a poor choice for os development, not that the language isn't good in other areas.


You're right, it's not what I was implying at all. I'm just saying languages evolve and make our lifes easier, that's why we do less assembly and more high level programming today. I'm sure DudeOfX is perfectly capable of learning any language.

Quote:
@Boobies Thanks! The book I'm reading now is a good book on theory and example, showing you how to build a full pascal compiler and debugger by the end of it in C++. He says that this isn't the end all book for compiler design (Do I sense red and purple dragons in my future?) but that this was an educational book, and you can then use to better understand those more advanced books that focus on things like optimization!


Heh, the Dragon Book. Good textbook that will get you started on compilers anyday :) Another book I'd recommend on the subject is Modern Compiler Implementation (2nd ed.) - there's also one in Java; this one covers more advanced topics.

Maybe we should start a new thread on this topic :)


Thu Oct 15, 2009 4:28 am
Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 34 posts ]  Go to page Previous  1, 2, 3, 4  Next


Who is online

Users browsing this forum: No registered users and 20 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by Vjacheslav Trushkin and tweaked by the BF Team.