OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Apr 19, 2024 7:01 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Language Discussion (High Level And Low Level) [C, ASM]
PostPosted: Tue May 20, 2014 11:33 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
metallevel wrote:
In fact, if you don't know C, you probably shouldn't be writing an OS at all! Even if you were writing an OS 100% in assembly, just about every low-level programmer knows C...


I tend to disagree with these two statements. I had quite some low-level, assembly (multiple architectures) and Pascal knowledge and experience prior to learning C and I must tell that that was already enough for me to write basic device drivers, schedulers, FAT-like file systems and other common OS parts, but nevertheless I struggled with C for quite some time because, simply put, it comes with a plethora of oddities, inconsistencies, non-intuitive syntax and behavior, especially unspecified, implementation-defined, and undefined behavior. Assembly looked much more defined and intuitive than C. And it still does. At the time I also lacked good books on C and the internet wasn't as accessible and rich as it is nowadays. Only now, having used C for about 15 years and having written a simple C compiler, can I say that I get it (mostly, not 100% of it, of course, as there still are a few dark corners, but I'm aware of them). Further, before C there was no C, but there was assembly and low-level programming alright and programmers made OSes without a single line of C! :)


Top
 Profile  
 
 Post subject: Re: Printing strings display smileys
PostPosted: Tue May 20, 2014 11:58 pm 
Offline
Member
Member
User avatar

Joined: Fri Jul 03, 2009 6:21 am
Posts: 359
alexfru wrote:
Further, before C there was no C, but there was assembly and low-level programming alright and programmers made OSes without a single line of C! :)


Assembly language was being seen as too low-level for the bulk of OS development about a decade before the first OS was written in C. I wrote about it in this post. The OS being written exclusively in assembly is a 1950s idea.

_________________
Every universe of discourse has its logical structure --- S. K. Langer.


Top
 Profile  
 
 Post subject: Re: Printing strings display smileys
PostPosted: Wed May 21, 2014 8:20 am 
Offline

Joined: Thu May 17, 2012 12:43 pm
Posts: 18
Location: in front of a computer
alexfru wrote:
metallevel wrote:
In fact, if you don't know C, you probably shouldn't be writing an OS at all! Even if you were writing an OS 100% in assembly, just about every low-level programmer knows C...


I tend to disagree with these two statements. I had quite some low-level, assembly (multiple architectures) and Pascal knowledge and experience prior to learning C and I must tell that that was already enough for me to write basic device drivers, schedulers, FAT-like file systems and other common OS parts, but nevertheless I struggled with C for quite some time because, simply put, it comes with a plethora of oddities, inconsistencies, non-intuitive syntax and behavior, especially unspecified, implementation-defined, and undefined behavior. Assembly looked much more defined and intuitive than C. And it still does. At the time I also lacked good books on C and the internet wasn't as accessible and rich as it is nowadays. Only now, having used C for about 15 years and having written a simple C compiler, can I say that I get it (mostly, not 100% of it, of course, as there still are a few dark corners, but I'm aware of them). Further, before C there was no C, but there was assembly and low-level programming alright and programmers made OSes without a single line of C! :)


Sorry, perhaps I wasn't general enough with that post. What I meant was that if you're not fluent in a common lower level language, which could be C, Forth, Pascal, etc, you probably don't know much about low level programming. C was just the example I gave because it seems C is the most common of these today. Also many people today learn higher level languages before lower level ones (at least at first), so if you don't know C (or Forth, or Pascal...) well, you probably know even less about assembly. That isn't to say that your first programming language can't be assembly, and in earlier days it often was, but nowadays this is quite rare.


Top
 Profile  
 
 Post subject: Re: Printing strings display smileys
PostPosted: Wed May 21, 2014 9:21 pm 
Offline
Member
Member

Joined: Tue Mar 04, 2014 5:27 am
Posts: 1108
bwat wrote:
Assembly language was being seen as too low-level for the bulk of OS development about a decade before the first OS was written in C. I wrote about it in this post. The OS being written exclusively in assembly is a 1950s idea.


But look how far we've gotten with Windows, growing out of DOS whose "kernel" was written entirely in assembly. :)

Don't also forget that there have been and still are small/embedded systems with little memory (similar to 1950s, just a tad more) and writing the kernel (not a terribly complex or big one) in assembly may not be such a bad idea.

Not every old idea is bad. It depends on context. Looks like we're having a resurgence of old ideas from the times when LISP was born, if not earlier. New functional languages appear, older languages (e.g. C++) get more functional with new features, and this stuff finds more and more uses and users.


Top
 Profile  
 
 Post subject: Re: Printing strings display smileys
PostPosted: Wed May 21, 2014 11:20 pm 
Offline
Member
Member
User avatar

Joined: Fri Jul 03, 2009 6:21 am
Posts: 359
alexfru wrote:
Not every old idea is bad.

Just want to point out that I'm not claiming the age of an idea is necessarily a indicator of its quality.

_________________
Every universe of discourse has its logical structure --- S. K. Langer.


Top
 Profile  
 
 Post subject: Re: Printing strings display smileys
PostPosted: Wed May 21, 2014 11:32 pm 
Offline
Member
Member
User avatar

Joined: Thu Dec 19, 2013 1:40 am
Posts: 100
Location: Asia, Singapore
One good example will be assembly. I don't care how hard it seems like, its much easier than writing a bunch of numbers that no one understands. And I am pretty sure it can be considered quite old compared to other languages.

_________________
CookieOS. Want a cookie? Its only black and white for now though, probably as bad as my baking skills.


Top
 Profile  
 
 Post subject: Language Discussion (High Level And Low Level)
PostPosted: Thu May 22, 2014 12:13 am 
Offline
Member
Member
User avatar

Joined: Fri Jul 03, 2009 6:21 am
Posts: 359
hometue wrote:
One good example will be assembly. I don't care how hard it seems like, its much easier than writing a bunch of numbers that no one understands.

But there are people who do understand. I did a lot of hand assembly yesterday for a homebrew processor; you get the hang of the machine code quite quickly. Assembly isn't really anything other than names for opcodes. I don't really see it as an idea any different from the idea of a programmable computer. As a designer, you can't create a processor without creating mnemonics for the opcodes - it's a human thing, we name things.

hometue wrote:
And I am pretty sure it can be considered quite old compared to other languages.

As far as languages are concerned, people were expressing thoughts in terms of what could be considered functional programming back in the 1930s and 40s [Alonzo Church and his lambda calculus], and the foundations of the mechanics of logic programming were invented back in the 1920s [Herbrand's PhD thesis of 1929 - but it took until the 1970s before logic was given a computational interpretation].

With regards to hardware implementation, Charles Babbage used the carry select adder in his analytical engine (1834-1871) which is long before students of digital design were taught it as an improvement on the ripple carry adder.

Finally, in the introduction to The pi-calculus. A Theory of Mobile Processes by Sangiorgi and Walker, the late Robin Milner wrote:
Quote:
The notion of calculational process, or algorithm, is a lot older than computing technology; so, oddly enough, a lot of computer science existed before modern computers.

_________________
Every universe of discourse has its logical structure --- S. K. Langer.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 74 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:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group