LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-06-2010, 04:25 PM   #166
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454

Quote:
Originally Posted by MTK358 View Post
...
That's quite an unpleasant metaphor...
...
There are job ads with "bare metal" in them.
 
Old 04-06-2010, 04:27 PM   #167
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
I still don't get how I can "accidentally" type "rm -rf /" and assemle it.
 
Old 04-06-2010, 04:27 PM   #168
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by Sergei Steshenko View Post
There are job ads with "bare metal" in them.
What do you mean?

It's the "skinned, but still living body" part that got me.
 
Old 04-07-2010, 12:04 AM   #169
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
What do you mean?

It's the "skinned, but still living body" part that got me.
"Bare metal" stands for SW which works on HW without any OS yet.

OS is the metaphorical skin. And/or rather user mode is skin on. The skin can be put both on and off - in kernel mode it's with the skin off.
 
Old 04-07-2010, 12:07 AM   #170
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
I still don't get how I can "accidentally" type "rm -rf /" and assemle it.
But you accidentally can remove files. And the point is that standard "C" library ('glibc' in Linux) "belongs" to "C"; in assembly it would be logical to use system calls. So, you make a mistake in a system call and delete a file instead of reading from it.
 
Old 04-07-2010, 06:58 AM   #171
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Even if I would be doing file operations, wouldn't I be doing them on test files I specially made?

And it's the shell, not glibc, that processes wildcards.
 
Old 04-07-2010, 07:38 AM   #172
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
Even if I would be doing file operations, wouldn't I be doing them on test files I specially made?

And it's the shell, not glibc, that processes wildcards.

The point is that you may accidentally delete a file.
 
Old 04-07-2010, 08:26 AM   #173
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by Sergei Steshenko View Post
Now imagine that by mistake your program in whatever language executes

Code:
\rm -rf /
You're close to convincing me that the next time I experiment trying to learn bash scripting I should be in a different account containing nothing else of value.

But I don't think anyone is convincing anyone either way about the merits of that level of paranoia for learning asm.

Not knowing the language still only makes it easy to do by accident things that are fairly easy to do.

Very destructive programs are easy to write by accident in bash, but hard to write by accident in asm. Even if you know near zero asm and are blindly changing tutorials you don't understand and even if you're fairly competent in bash, you experiments in asm are still less likely to do serious harm than your experiments in bash.

BTW, I loved the metaphor:
Quote:
Originally Posted by Sergei Steshenko View Post
programming in assembly is like touching completely skinned, but still living, CPU body.
But it ought to say "programming in assembly without an OS"

Programming in assembly without an OS is a more obscure skill than programming in assembly with an OS. I think there is plenty of justification for learning asm with OS, but never learning asm without OS. Even if you want to learn asm without OS, it is best to get some solid skills in asm with OS first. So despite the fun metaphor, I think that whole subject area is outside the focus of this thread.

Quote:
Originally Posted by Sergei Steshenko View Post
The point is that you may accidentally delete a file.
You probably will accidentally delete a file.

At least once (long ago) while testing C programs I was writing, I accidentally deleted a file. More than once while trying to correct someone else's bad Python programs. More than once while experimenting with bash. And despite my incredible asm skills, at least once (very long ago) while learning to do file I/O in asm, I accidentally deleted a file.

I wouldn't do such experiments even in the directory where I have important files. When I'm at all uncertain of file I/O operations, I generally avoid even working with file names similar to important files elsewhere.

Since I tend to multi task with a lot of open windows, experimenting in a different directory from real work is natural. Experimenting in a different login from real work is a significant step less convenient and I generally wouldn't do it.

Last edited by johnsfine; 04-07-2010 at 08:37 AM.
 
Old 04-07-2010, 08:29 AM   #174
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Quote:
Originally Posted by johnsfine View Post
You're close to convincing me that the next time I experiment trying to learn bash scripting I should be in a different account containing nothing else of value.

But I don't think anyone is convincing anyone either way about the merits of that level of paranoia for learning asm.

Not knowing the language still only makes it easy to do by accident things that are fairly easy to do.
Agreed.
 
Old 04-07-2010, 08:34 AM   #175
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by johnsfine View Post
You're close to convincing me that the next time I experiment trying to learn bash scripting I should be in a different account containing nothing else of value.
...

This is the way I initially tested Skype for Linux - a closed source app, who knows what it is doing
 
Old 04-07-2010, 08:37 AM   #176
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by johnsfine View Post
...
Programming in assembly without an OS is a more obscure skill than programming in assembly with an OS. I think there is plenty of justification for learning asm with OS, but never learning asm without OS. Even if you want to learn asm without OS, it is best to get some solid skills in asm with OS first. So despite the fun metaphor, I think that whole subject area is outside the focus of this thread.
In my professional life programming in assembly without an OS was a must, i.e. a job duty. I.e. I do not see too much sense in learning an assembly nowadays unless ultimately it will be used for programming without an OS.

Well, but if someone is going to write a full fledged compiler, it's another story.
 
Old 04-07-2010, 08:39 AM   #177
MTK358
LQ 5k Club
 
Registered: Sep 2009
Posts: 6,443

Original Poster
Blog Entries: 3

Rep: Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723Reputation: 723
Why not start simple with an OS then maybe move on to without an OS?
 
Old 04-07-2010, 09:03 AM   #178
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by MTK358 View Post
Why not start simple with an OS then maybe move on to without an OS?
But this will complete the sweet procrastination, won't it ?
 
Old 04-07-2010, 09:49 AM   #179
johnsfine
LQ Guru
 
Registered: Dec 2007
Distribution: Centos
Posts: 5,286

Rep: Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197Reputation: 1197
Quote:
Originally Posted by Sergei Steshenko View Post
I do not see too much sense in learning an assembly nowadays unless ultimately it will be used for programming without an OS.
Even if you will never write a useful line of asm code, learning to code in asm with an OS, is a valuable skill that will improve the quality of your programming in languages like C++ as well as your skill at debugging.

Learning to code in asm without an OS would mostly be useful if you intend someday to write or significantly modify an OS. (I myself have done so, but don't expect to do so again).

Coding and debugging C++ is a more commonly useful skill than modifying an OS. So asm with an OS is more relevant knowledge than asm without an OS.
 
1 members found this post helpful.
Old 04-07-2010, 10:21 AM   #180
Sergei Steshenko
Senior Member
 
Registered: May 2005
Posts: 4,481

Rep: Reputation: 454Reputation: 454Reputation: 454Reputation: 454Reputation: 454
Quote:
Originally Posted by johnsfine View Post
...
Learning to code in asm without an OS would mostly be useful if you intend someday to write or significantly modify an OS.
...
Not at all. I am from HW world, so, say, when a chip with CPU inside needs to be simulated using an HDL, someone has to provide the model with code which works from reset on. And at least reset and exception handling routines were written in assembly.

Likewise, when the chip is taped out, it needs to be tested - no OS at all is present. So reset and IRSs are written in assembly, and the rest in "C".

In HW world there is a term "bring up" - it the place for assembly.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ASM or C++? Hb_Kai Programming 16 01-20-2010 09:12 AM
Is ASM dangerous? MrCode Programming 37 11-18-2009 08:29 AM
ASM x32 vs ASM x64 Tegramon Programming 3 02-27-2008 02:26 PM
I/O in ASM Mercurius Programming 10 11-16-2006 07:02 PM
ASM question zWaR Programming 2 06-26-2004 11:42 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 12:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration