Re: C and Low-level Storage (was: I need a new compiler...



On 2008-12-16 17:02:31 -0600, "William M. Klein" <wmklein@xxxxxxxxxxxxxxxxxxxx> said:

<much debate snipped>

Michael Wojick,
I can't tell. Have you been debating a "real-world" issue or a philosophical
one?

In other words, are there existing implementations of C that (as required)
support "pointers" but do NOT allow (or support) pointers that "get the
program" to system-level storage?

I am NOT a C programmer, but when I have interacted with those that do use it,
it seems to me that all implementations that they use DO allow the C program to
access (at least "read") data at "system controlled" (low-level?) storage.

It is also true, that some "systems" do NOT allow the "average" C (or Assembler
or whatever) program to MODIFY "system-controlled" storage, but that is a
different question (to me) than accessing such storage.

If there are C implementations that do not allow programmers to "read" the
storage where "system control blocks, etc" reside, I would be interested in
which C and on what platforms these exist.

If you are just stating that the C Standard does not REQUIRE this, then that may
be "nice to know" - but is different from what actual implementations DO.

If I understand what you are saying Bill, you are asking if C the language can access "system memory."

Technically, C can access any address the machine can provide access to, including any system storage.

Practially speaking, the Operating System, and sometimes the hardware, protects some areas of memory. This is especially true in all our modern systems like z/OS, Linux, z/VM, and even Windows, since applications run in a designed application space.

For example, on my zLinux systems, every application in the system loads and run from address X'400000'. Of couse, that is a *virtual* address, which means there may be a thousand applcations running from the virtual address, but from 1000 different real addresses. It gets complex, because sometimes text (code) sections are designated read-only in memory, and only one copy of them is loaded. (This is Linux,
drives z/OS programmers crazy because they cannot store variable in the code section - at least if they ever intend to change those variable's values... :)

And then you get into shared memory segments. Take the same chunk of real memory, attach it to one or more applications - at different virtual addresses.

Like I said, it gets complex. Fun though. :)

Another point to consider, most of Unix, including the kernel level code (which by the way, usually *does* have access to every real memory address, system and application....) is written in plain old C. Just a couple or three thousand lines of assembler, and the rest, millions of lines of code, in C.

Just out of curiousity - are there any OS's written in Cobol?
I don't know of any, but I bet there are one or two out there. :)


.



Relevant Pages

  • Re: C and Low-level Storage (was: I need a new compiler...
    ... program" to system-level storage? ... be "nice to know" - but is different from what actual implementations DO. ... protects some areas of memory. ... usually *does* have access to every real memory ...
    (comp.lang.cobol)
  • Re: C and Low-level Storage (was: I need a new compiler...
    ... be "nice to know" - but is different from what actual implementations D ... language can access "system memory." ... to, including any system storage. ... It is only the CPU that needs to 'read' the executable code, ...
    (comp.lang.cobol)
  • Re: C and Low-level Storage (was: I need a new compiler...
    ... be "nice to know" - but is different from what actual implementations D ... Any kind of memory storage, by the way, has to be included at an address the machine can provide access to. ... Seen lots of cases where people put executable code in the data sections though. ... usually *does* have access to every real memory ...
    (comp.lang.cobol)
  • Re: C and Low-level Storage (was: I need a new compiler...
    ... be "nice to know" - but is different from what actual implementations D ... protects some areas of memory. ... It is only the CPU that needs to 'read' the executable code, ... usually *does* have access to every real memory ...
    (comp.lang.cobol)
  • Re: C and Low-level Storage (was: I need a new compiler...
    ... be "nice to know" - but is different from what actual implementations DO. ... Whether 'system storage' is included within "any address the machine ... protects some areas of memory. ... usually *does* have access to every real memory ...
    (comp.lang.cobol)