OT: This Swift thing

R

Roy Smith

Michael Torrie said:
Technically C doesn't [have features to support hitting the hardware]
either, except via subroutines in libc, though C does have pointers
which would be used to access memory.

Several language constructs in C are there specifically to diddle bits
in hardware. Bit fields were in the earliest implementations of the
language to allow you to address individual bit control and status bits
in memory-mapped device controllers. The volatile keyword is there to
deal with bits which change value on their own (as hardware status
registers do).

And, why do you need a library routine to touch a memory location, when
you can just dereference an integer? :)
 
M

Michael Torrie

Several language constructs in C are there specifically to diddle bits
in hardware. Bit fields were in the earliest implementations of the
language to allow you to address individual bit control and status bits
in memory-mapped device controllers. The volatile keyword is there to
deal with bits which change value on their own (as hardware status
registers do).

And, why do you need a library routine to touch a memory location, when
you can just dereference an integer? :)

Which of course, technically, Pascal has too.

But memory addressing is only half the story. You still need interrupts
and ioctl access, both of which happen via assembly instructions that
libc exposes via a standard C subroutine interface.

Really any language can access hardware this way. Whether it's
MicroPython on an embedded system, or BASIC on a pic. The lines are
being blurred.
 
R

Roy Smith

Michael Torrie said:
Which of course, technically, Pascal has too.

But memory addressing is only half the story. You still need interrupts
and ioctl access, both of which happen via assembly instructions that
libc exposes via a standard C subroutine interface.

Well, on a machine where all I/O is memory mapped, it's really 3/4 of
the story, but I get your point.
 
D

Dennis Lee Bieber

What was wrong with just running the original pdp-11 binaries on the VAX
in compatibility mode? :)

I suspect maintenance nightmare -- the systems being controlled kept
gaining capabilities that required modification to the ground control
software to command them.
 
D

Dennis Lee Bieber

Which of course, technically, Pascal has too.
Not "standard" Pascal... It had pointer types, but no means to "stuff"
an integer into the pointer variable in order to dereference it as a memory
address...
But memory addressing is only half the story. You still need interrupts
and ioctl access, both of which happen via assembly instructions that
libc exposes via a standard C subroutine interface.
I/O interrupts is a level above the "driver" example I spoke of... I'm
talking a true low-level "test status register, if data ready, copy data
register, clear status register, return data to caller"...

ioctl() is an OS abstraction mechanism to provide a standardized means
for applications to provide uncommon parameters to an I/O driver... Heck,
/libc/ is above the level of code I'm defining. What is an interrupt --
typically a handler (function) address stored in a fixed location used by
the CPU when an external hardware signal goes high... Nothing prevents one
from writing that handler in C and using C's various casting operations to
stuff it into the vector memory.
 
S

Steven D'Aprano

About a decade later, said manager retired and confessed that the choice
of Pascal was a mistake

There's Pascal and there's Pascal. Standard Pascal, I admit, is woefully
unsuitable for real world work. But Pascal with suitable extensions was
good enough for the first 6 generations of the Macintosh operating system
and key applications, at a time when *nobody* was even coming close to
doing what the Mac was capable of. (Admittedly, a certain number of the
core OS libraries, most famously Quickdraw, were handwritten in assembly
by a real genius.) By the mid-80s, Apple's SANE (Standard Apple Numeric
Environment) was quite possibly the best environment for doing IEEE-754
numeric work anywhere. But of course, Macintoshes were toys, right, and
got no respect, even when the Mac G4 was the first PC powerful enough to
be classified by US export laws as a supercomputer.

[Disclaimer: Pascal on the Mac might have been far ahead of the pack when
it came to supporting IEEE-754, but it didn't have the vast number of
(variable-quality) Fortran libraries available on other systems. And
while it is true that the G4 was classified as a supercomputer, that was
only for four months until the Clinton administration changed the laws.
Apple, of course, played that for every cent of advertising as it could.]
 
S

Steven D'Aprano

And, why do you need a library routine to touch a memory location, when
you can just dereference an integer? :)

And in one sentence we have an explanation for 90% of security
vulnerabilities before PHP and SQL injection attacks...

C is not a safe language, and code written in C is not safe. Using C for
application development is like shaving with a cavalry sabre -- harder
than it need be, and you're likely to remove your head by accident.
 
R

Roy Smith

Steven D'Aprano said:
And in one sentence we have an explanation for 90% of security
vulnerabilities before PHP and SQL injection attacks...

C is not a safe language, and code written in C is not safe. Using C for
application development is like shaving with a cavalry sabre -- harder
than it need be, and you're likely to remove your head by accident.

I never claimed C was a safe language. I assume you've seen the classic
essay, http://www-users.cs.york.ac.uk/susan/joke/foot.htm ?

And, no, I don't think C is a good application language (any more).
When it first came out, it was revolutionary. A lot of really amazing
application software was written in it, partly because the people
writing in it were some of the smartest guys around. But, that was 40
years ago. We've learned a lot about software engineering since then.

We've also got machines that are so fast, it's not longer critical that
we squeeze out every last iota of performance. Oh, but wait, now we're
trying to do absurd things like play full-motion video games on phones,
where efficiency equates to battery life. Sigh.
 
C

Chris Angelico

We've also got machines that are so fast, it's not longer critical that
we squeeze out every last iota of performance. Oh, but wait, now we're
trying to do absurd things like play full-motion video games on phones,
where efficiency equates to battery life. Sigh.

Efficiency will never stop being important. Efficiency will also never
be the one most important thing. No matter how much computing power
changes, those statements are unlikely to be falsified...

ChrisA
 
G

Gregory Ewing

Michael said:
Technically C doesn't either, except via subroutines in libc, though C
does have pointers which would be used to access memory.

The Pascal that Apple used had a way of casting an
int to a pointer, so you could do all the tricks
you can do with pointers in C.
 
G

Gregory Ewing

Dennis said:
Not "standard" Pascal... It had pointer types, but no means to "stuff"
an integer into the pointer variable in order to dereference it as a memory
address...

Although most implementations would let you get the same
effect by abusing variant records (the equivalent of a
C union).
What is an interrupt --
typically a handler (function) address stored in a fixed location used by
the CPU when an external hardware signal goes high... Nothing prevents one
from writing that handler in C and using C's various casting operations to
stuff it into the vector memory.

Most CPU architectures require you to use a special
"return from interrupt" instruction to return from
a hardware interrupt handler. So you need at least
a small assembly language stub to call a handler
written in C, or a C compiler with a non-standard
extension to generate that instruction.
 
S

Steven D'Aprano

We've also got machines that are so fast, it's not longer critical that
we squeeze out every last iota of performance. Oh, but wait, now we're
trying to do absurd things like play full-motion video games on phones,
where efficiency equates to battery life. Sigh.

That's where there needs to be a concerted push to develop more efficient
CPUs and memory, in the engineering sense of efficiency (i.e. better
power consumption, not speed). In desktop and server class machines,
increasing speed has generated more and more waste heat, to the point
where Google likes to build its server farms next to rivers to reduce
their air conditioning costs. You can't afford to do that on a battery.

Even for desktops and servers, I'd prefer to give up, say, 80% of future
speed gains for a 50% reduction in my electricity bill.
 
M

MRAB

Pascal is essentially equivalent to C, except Pascal has a cleaner
syntax. I like the fact that the semicolon is a separator. Also, the
variable declaration syntax is done more smartly in Pascal. And the
pointer/array confusion in C is silly.
I also like the fact that the semicolon is a separator, but, in
practice, misplaced semicolons can cause problems, so languages
descended of Pascal prefer to have explicit terminators.
 
R

Roy Smith

Steven D'Aprano said:
That's where there needs to be a concerted push to develop more efficient
CPUs and memory, in the engineering sense of efficiency (i.e. better
power consumption, not speed). In desktop and server class machines,
increasing speed has generated more and more waste heat, to the point
where Google likes to build its server farms next to rivers to reduce
their air conditioning costs. You can't afford to do that on a battery.

Even for desktops and servers, I'd prefer to give up, say, 80% of future
speed gains for a 50% reduction in my electricity bill.

For desktops, I'm more concerned about physical size. On my desk at
work, I have a Mac Mini. It's about 8 inches square, by an inch and a
half high. It sits in a corner of my desk and doesn't take up much
room. The guy that sits next to me has a Dell running Linux. It's
about 8 inches wide, 15 inches deep, and 24 inches high. In terms of
CPU, memory, disk, video, networking, etc, they have virtually identical
specs.

I've never compared the power consumption, but I assume his eats many
time the electricity mine does (not to mention makes more noise).
 
G

Gene Heskett

For desktops, I'm more concerned about physical size. On my desk at
work, I have a Mac Mini. It's about 8 inches square, by an inch and a
half high. It sits in a corner of my desk and doesn't take up much
room. The guy that sits next to me has a Dell running Linux. It's
about 8 inches wide, 15 inches deep, and 24 inches high. In terms of
CPU, memory, disk, video, networking, etc, they have virtually
identical specs.

I've never compared the power consumption, but I assume his eats many
time the electricity mine does (not to mention makes more noise).

You may want to reconsider that statement after the first fan failure in
your mini. We've had quite a few Mac's in the tv station, as video
servers, graphics composers, etc. The airflow for cooling in them is
controlled by baffles to get the maximum air flow past the hot spots, but
a fan failure usually cooks the whole thing. And at that time, Macs
warranty did not cover collateral damage from a fan failure. Cooked cpu?
Too bad, so sad.

Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
 
R

Roy Smith

Gene Heskett said:
You may want to reconsider that statement after the first fan failure in
your mini. We've had quite a few Mac's in the tv station, as video
servers, graphics composers, etc. The airflow for cooling in them is
controlled by baffles to get the maximum air flow past the hot spots, but
a fan failure usually cooks the whole thing. And at that time, Macs
warranty did not cover collateral damage from a fan failure. Cooked cpu?
Too bad, so sad.

The CPU (or maybe I'm thinking of the video card?) in the Dell has some
huge heat sink, a bunch of funky ductwork, and a dedicated fan. I
suspect if that fan were to fail, the chip it's cooling would fry itself
pretty quickly too.
 
G

Gene Heskett

The CPU (or maybe I'm thinking of the video card?) in the Dell has some
huge heat sink, a bunch of funky ductwork, and a dedicated fan. I
suspect if that fan were to fail, the chip it's cooling would fry
itself pretty quickly too.

Probably. I have lost several nvidia video cards over the years from fan
failures. My phenom in this box has a 75C shutdown that has not been
tested. Best fan & sink assembly I could buy at the time. And I have
gotten into the habit of replacing the 45 cent fans on the video card with
bigger, ball bearing fans at the first hint of a squall. A lot of this
stuff has more engineering time in assuring it will die 2 weeks out of
warranty, than in giving top performance. And that goes double for stuff
wearing an Antec label. I'm on the 4th psu in this box, its a $12.65 in
10 packs 350 watter, Chinese of course, running 4 terrabyte drives and a
USB tree that looks like a weeping willow plus the original 2.1Mhz Phenom.
165 watts IIRC. I run gkrellm and watch its voltages. Now about 3 years
old, the 5 volt line is still 5.08 volts. Whats not to like? The 2
Antecs I was dumb enough to try, had 5 volt lines down to 4.75 volts and
doing random resets at the end of the 1 year warranty. Thats not an
excusable failure in my book.

Cheers, Gene Heskett
--
"There are four boxes to be used in defense of liberty:
soap, ballot, jury, and ammo. Please use in that order."
-Ed Howdershelt (Author)
Genes Web page <http://geneslinuxbox.net:6309/gene>
US V Castleman, SCOTUS, Mar 2014 is grounds for Impeaching SCOTUS
 
C

Chris Angelico

I have lost several nvidia video cards over the years from fan
failures.
From a discussion on one of Threshold RPG's out-of-character channels:

Kurdt: I wouldn't disturb the fan controller.
Kurdt: Ever seen an AMD without a fan? ;)
Leshrak: heh, yeah
Leshrak: actually. it's not a pretty smell
Kurdt: Especially when it's overclocked. It goes FZZZZT in under two seconds.

I think that's about right.

ChrisA
 
C

Carlos Anselmo Dias

Probably. I have lost several nvidia video cards over the years from fan
failures. My phenom in this box has a 75C shutdown that has not been
tested. Best fan & sink assembly I could buy at the time. And I have
gotten into the habit of replacing the 45 cent fans on the video card with
bigger, ball bearing fans at the first hint of a squall. A lot of this
stuff has more engineering time in assuring it will die 2 weeks out of
warranty, than in giving top performance. And that goes double for stuff
wearing an Antec label. I'm on the 4th psu in this box, its a $12.65 in
10 packs 350 watter, Chinese of course, running 4 terrabyte drives and a
USB tree that looks like a weeping willow plus the original 2.1Mhz Phenom.
165 watts IIRC. I run gkrellm and watch its voltages. Now about 3 years
old, the 5 volt line is still 5.08 volts. Whats not to like? The 2
Antecs I was dumb enough to try, had 5 volt lines down to 4.75 volts and
doing random resets at the end of the 1 year warranty. Thats not an
excusable failure in my book.

Cheers, Gene Heskett
Reading this reminds me the hypothetical dilemma of (...)

If one solution based in n dependencies(client apis) would need to
optimize it's system(in dependencies too) to face the massive hits of
search engines in the indexation of n millions of pages with tracking
integrated at several levels(...) ... how would it be solved? ... It
would turn at n volts(...) and it would need to decrease the voltage(...)

This is somehow integrated in what I wrote in the post with the subject
'python team(...)'

To put this working and optimized is really fascinating (...)

Regards,
Carlos
 
S

Sturla Molden

Chris Angelico said:
Kurdt: I wouldn't disturb the fan controller.
Kurdt: Ever seen an AMD without a fan? ;)
Leshrak: heh, yeah
Leshrak: actually. it's not a pretty smell
Kurdt: Especially when it's overclocked. It goes FZZZZT in under two seconds.

I think that's about right.

One would think that in 2014, a device called a "thermostat" would shut
down the power before expensive equipent goes up in a ball of smoke.


Sturla
 

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

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top