freestanding vs hosted implementations

  • Thread starter Bill Cunningham
  • Start date
B

Bill Cunningham

I hope this isn't OT.
What is the purpose of a free standing implementation of C? stdio.h
isn't even included. I've only used hosted implentation.

Bill
 
A

Artie Gold

bd said:
In some situations, the whole C Library would be impossible to fit. E.g.
an embedded device. Or, it may not yet be available, like in the Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~

Could you elaborate?

Thanks,
--ag
 
B

bd

~~~~~~~

Could you elaborate?

The Linux kernel dosen't have access to the C library - it's responsible
for using non-standard methods to load it for other programs. Also, the
malloc() method of memory allocation is unacceptable for the kernel, as it
leads to internal fragmentation of the address space.
 
S

Simon Biber

Artie said:
~~~~~~~~~~~~~~~~~

Could you elaborate?

Code that runs from an operating system kernel, such as a device driver,
typically does not have access to the C standard library. The kernel is
considered to be a freestanding environment.
 
A

Artie Gold

bd said:
The Linux kernel dosen't have access to the C library - it's responsible
for using non-standard methods to load it for other programs. Also, the
malloc() method of memory allocation is unacceptable for the kernel, as it
leads to internal fragmentation of the address space.
Ah. _That's_ what you meant.
Of course, infinite regress being what it is.... ;-)
[Of course a kernel would be inherently non-standard in any event; its
`hostedness' is largely irrelevant.]

Thanks,
--ag
 
M

Morris Dovey

Bill said:
> What is the purpose of a free standing implementation of C?
> stdio.h isn't even included. I've only used hosted
> implentation.

Basically, it provides for those environments where C programs
can have non-standard entry/exit mechanisms, i.e. no command line
(and hence no command line parameters, no system() function that
depends on a shell or command line interpreter, and (perhaps)
nothing to return to.

Most of the free-standing implementations are embedded
applications (e.g. cable modem, washing machine); and the
remainder are the "host" part of hosted systems (ex: kernel, I/O
subsystems).

Free-standing implementations are free to dispense with support
for those elements set forth in the standard that just don't make
any sense in their particular context. Typically, the standard
I/O capabilities are severely trimmed or omitted, memory
management may be dropped in favor of pre-allocated
regions/variables, and pointers to specific memory, I/O, and
control space locations may abound.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top