![]() |
| | #1 |
| Eager young mind Join Date: Jun 2006
Posts: 342
| An interview question 1) Can I execute a C program on a machine without an OS? 2) I have 2 machines. One has an OS, the other doesnt. I have to execute the program on the second machines by using the first machine. Any ideas? About the second one, even to login to the second machine, i need the support of the OS on the second machine,right? Is it even possible?
__________________ In the middle of difficulty, lies opportunity |
| kris.c is offline | |
| | #2 |
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| 1) Depends on what you call an OS. If you call a bootstrapper that just loads the program from a known disk location and jumps there an OS, then the answer is no. It is just about impossible (and anyway not a good idea) to write such a bootstrapper in C - that's still the exclusive realm of assembly or even lower levels. On the other hand, if the bootstrapper doesn't count, then the answer is obviously yes. Most OSs themselves are, after all, C programs. However, this is where the distinction between a hosted and a freestanding C implementation is important. The hosted implementation is what you're used to: starts with main(), provides the runtime library, all that nice stuff. A freestanding implementation is bare-bones: it might start anywhere, provides whatever it wants as a library, and so on. Without an OS, you'll most likely only have a freestanding C implementation at your disposal. 2) What is meant with "by using the first machine"? You'd have to compile the program on the machine with the OS, most likely, but I can't imagine anything beyond that. A machine without an OS doesn't have a concept of a login.
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law |
| CornedBee is offline | |
| | #3 |
| Jaxom's & Imriel's Dad Join Date: Aug 2006 Location: Alabama
Posts: 877
| 1) Yes. 2) Depends on what the BIOS does/looks for at boot. I'd guess there would be something along the lines of looking for code via Serial or some other communication device. . . like, for example, a chip programmer (what's it called??? JDEC Programmer or something. . . cannot remember at the moment. I'll edit if I remember -- or someone else can correct me). |
| Kennedy is offline | |
| | #4 |
| Protocol Test Engineer Join Date: Sep 2005 Location: fseek(UK)
Posts: 1,324
| Well the second one, we have something like network boot, which mean that the system can boot through network. You can actual configure this on your BIOS setup. If this was possible you actual do something like what u wanted. But dont no the indetails concept of it. U might get some help from others. Hope you get an idea of possibility of your application. ssharish2005 Last edited by ssharish2005; 01-10-2007 at 11:08 AM. |
| ssharish2005 is offline | |
| | #5 |
| Eager young mind Join Date: Jun 2006
Posts: 342
| @CornedBee : So, if i can tell the bootstrapper where my C code is ( assume this is done) , i can execute that C program. Right? > What is meant with "by using the first machine"? I meant, the first machine is used as the interface between the second machine and the user, but the actual work is done by the second machine. @Kennedy : >1) Yes. Are your thoughts also similar to cornedbee's? If no, could you please elaborate? @ssharish: yeah, the network boot seems to be a good i dea, i will look into more stuff on that.. thanks.
__________________ In the middle of difficulty, lies opportunity |
| kris.c is offline | |
| | #6 |
| Crazy Fool Join Date: Jan 2003 Location: Canada
Posts: 2,596
| The answer to both is "yes", just define "machine" as a hardware implemented C interpreter
__________________ jeff.bagu.org - Terrain rendering and other random stuff |
| Perspective is offline | |
| | #7 |
| Eager young mind Join Date: Jun 2006
Posts: 342
| @Perspective : could you please elaborate on how exactly one goes about? Or is it all, already there on this page?
__________________ In the middle of difficulty, lies opportunity |
| kris.c is offline | |
| | #8 | |||
| Cat without Hat Join Date: Apr 2003
Posts: 8,492
| Quote:
Quote:
Quote:
__________________ All the buzzt! CornedBee"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code." - Flon's Law | |||
| CornedBee is offline | |
| | #9 | |||
| Jaxom's & Imriel's Dad Join Date: Aug 2006 Location: Alabama
Posts: 877
| Quote:
Quote:
Quote:
| |||
| Kennedy is offline | |
| | #10 | |
| Crazy Fool Join Date: Jan 2003 Location: Canada
Posts: 2,596
| Quote:
It's a "thinking outside the box" answer.
__________________ jeff.bagu.org - Terrain rendering and other random stuff | |
| Perspective is offline | |
| | #11 | |
| Registered User Join Date: Jan 2007
Posts: 8
| Quote:
| |
| Baccarat is offline | |
![]() |
| Thread Tools | |
| Display Modes | |
|
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| another do while question | kbpsu | C++ Programming | 3 | 03-23-2009 12:14 PM |
| Question about pointers #2 | maxhavoc | C++ Programming | 28 | 06-21-2004 12:52 PM |
| Job Interview Coming Up | adamg | C Programming | 5 | 05-02-2004 11:25 PM |
| Question... | TechWins | A Brief History of Cprogramming.com | 16 | 07-28-2003 09:47 PM |
| Question, question! | oskilian | A Brief History of Cprogramming.com | 5 | 12-24-2001 01:47 AM |