Another Tricky Problem I am Messing With (Not Homework)

M

Mark McIntyre

OK, "you" ("us") first...

No, you first. You're the one shouting.
I like technical discussions, except I'm really not that technically
knowledgeable,

Then you are hardly qualified to comment.
.this sometimes
goads people who are not very technically knowledgeable but rely
on a resume indicating technical knowledge to "take advantage"...

In other words, you like trolling, and think its amusing.

I don't KNOW what it does either! I just ASSUME

Then what on earth makes you think you can insult other people for not
knowing?

Either you're a knave or a fool. Which is it?
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 
B

Bill Reid

Oh, I'm sorry I didn't get back to you sooner, but I did want to
let you know that of all the abusive idiots in this thread, you win
the "Biggest Idiot" prize! (You only tied for "Most Abusive",
sorry...)

Old Wolf said:
I think you are refusing to explain your _sleep function
on purpose because you know that you are talking crap.

This is why you win the prize for "Biggest Idiot"...how the hell
am I supposed to know exactly what's happening in any library
function where I don't have access to the source? I NEVER
said that I wrote the "_sleep" function, I specifically said exactly
where it came from, so in addition to technical incompentency,
you also can't read worth a damn!
(Note to anyone who may have only just joined this thread -
OP wrote his own function titled "_sleep" but has not yet
explained what it does, other than to "sleep/wait/delay").

(Not to nobody, since that's how many people care: the above
note has nothing to do with what actually was discussed in this thread.)
Your posted results showed that calling _sleep(4) caused
your system to sleep for approximately 4 seconds of
processor time.

What an idiot...
Yet you seem to be claiming in other messages that your
_sleep function does not consume any significant amount
of processor time while it is 'running'.

What an idiot...
Only a true incompetent would think that 4 seconds
is a good approximation of 0 seconds in the context
of how much processor time was used in a wall clock
4 second sleep.

Hey this ain't horseshoes, and by the way: you're an idiot.
No shit sherlock. BTW, looking forward to your post
next week where you tell a plumber how to unblock
a toilet.

If you were the plumber, I am quite sure I would ultimately
have to operate the plunger myself, after listening to your idiotic
blather for sufficient time to realize you were nothing more
than an abusive idiotic fake...
 
B

Bill Reid

Keith Thompson said:
If you're "really not that technically knowledgeable", you really
should pay attention to those of us who are.

Heh...the really operative part of what I wrote above was:

Kinda like some asswipe mechanic who completely rips off old
ladies with bogus auto repairs and couldn't actually fix a car correctly
to save his worthless life...

I dangled that little piece of bait of "really not that technically
knowledgeable", and EVERY SINGLE ABUSIVE IDIOT in
this thread hit at it like a brain-damaged bass, even when told
explicitly what I was actually "angling" for.

Bottom line: there are those people who TELL you they know
everything, and then those who truly know a lot. And telling the
difference between the two is just as simple as that...
[...]
As far as the "fine" documentation is concerned, give me a break...

void _sleep(unsigned seconds);

Description

Suspends execution for an interval (seconds).

With a call to _sleep, the current program is suspended from
execution for the number of seconds specified by the argument
seconds. The interval is accurate only to the nearest hundredth of a
second or to the accuracy of the operating system clock, whichever
is less accurate.

Return Value

None.

---end of compiler package "man page"

Great. What does you're implementation's documentation say about the
clock() function?

Not that it matters, but it appears to be a typically garbled and
contradictory re-write of the standard language:

clock_t clock(void);

Description

Determines processor time.

clock can be used to determine the time interval between two events.
To determine the time in seconds, the value returned by clock should
be divided by the value of the macro CLK_TCK.

Return Value

On success, clock returns the processor time elapsed since the
beginning of the program invocation.

On error (if the processor time is not available or its value cannot be
represented), clock returns -1.

---end of compiler package "man page"

Seems to be talking out of both ends of its ass (a little like the
standard description of "clock"). By the way, I dug into the header
file and CLK_TICK is just a macro re-define of CLOCKS_PER_SEC.
Either one works the same.

Likewise, _sleep() is just a re-define of sleep(), but using sleep()
generates a warning about "obsolete function" or something like that...
[...]
* people who think that a "sleep" function on a modern
multi-tasking operating system performs a "busy-wait" because
of some interpretation of the "C" standard "requirement" for
"clock()" deserve all the abuse that can be heaped upon
their heads, 'specially if they state that they have some type
of superior technical "knowledge" that brought them to
that conclusion...

Who claimed that a sleep function performs a busy-wait?

Everybody but me!

"I have no idea how your '_sleep' function works. I suspect
that either '_sleep' delays for a specified interval of CPU time,
or your program is using exactly 1 second of CPU time per
second of real time." - "Keith Thompson"

"My guess: when you're running this process, it takes
100% of hte CPU available for the duration of hte "busy
wait" loop." - "Mark McIntyre"

"Yet you seem to be claiming in other messages that your
_sleep function does not consume any significant amount
of processor time while it is 'running'." - "Old Wolf"

Actually, one poster calling themself "buuuuuum" ran a
little test and had the same results as what I got, that clock()
on his system apparently just measures the dreaded (to
some) "wall clock" time, but nobody responded to him
because after all, he admitted he's a "buuuuuum"...

And yes, my compiler really IS broken, if the definition of
"broken" is does not meet the mealy-mouthed "standard" for
clock(). It even measures friggin USER WAIT, for cryin'
out loud. I added a gets() to my test code, and sure enough,
I can set my watch by timing the number of seconds I while
away before I press RETURN:

int main(void) {
int inc;
clock_t start,end;

for(inc=1;inc<5;inc++) {
printf("Sleeping for %d seconds\n",inc);
start=clock();
_sleep(inc);
end=clock();
printf("Slept for %f seconds\n",((end-start)/CLOCKS_PER_SEC));
}

start=clock();
printf("Press RETURN after a few well-timed seconds\n");
gets(choice);
end=clock();
printf("Delayed for %f seconds\n",((end-start)/CLOCKS_PER_SEC));

return 0;
}

So in addition to the truths I listed in my last post, add "might
as well just change your oil yourself, since the creep at the shop
will just charge you money and not even do it, and if you point
out the oil still looks dirty, will tell you that you don't know anything
about cars."

Oh, and do your own programming too...
 
K

Keith Thompson

Bill Reid said:
And yes, my compiler really IS broken, if the definition of
"broken" is does not meet the mealy-mouthed "standard" for
clock(). It even measures friggin USER WAIT, for cryin'
out loud.
[...]

Neither the standard's definition of clock() nor your implementation's
documentation of it is particularly "mealy-mouthed". The standard
necessarily allows for differences in what various systems are able to
do, while clearly defining the behavior for systems that, for whatever
reason, aren't able to satisfy the requirements.

Your system unambiguously violates both the standard and its own
documentation (assuming you've been giving us accurate information).
If I were you, I'd complain to your vendor about it. But then again,
if I were you I'd try not to be such a rude long-winded blithering
idiot.

Bye.
 
K

Kenny McCormack

Keith Thompson said:
If I were you, I'd complain to your vendor about it. But then again,
if I were you I'd try not to be such a rude long-winded blithering
idiot.

Granted. You are rarely long-winded.
 
B

Bill Reid

Mark McIntyre said:
No, you first. You're the one shouting.

Actually, it IS impossible to "shout" online, but in terms of treating
people like idiots, I neither started that nor am I the worst offender...
Then you are hardly qualified to comment.

Another "hit" on the bait...
In other words, you like trolling, and think its amusing.

No. In real life, I hate liars and fakes, primarily because I like
to get stuff done, and liars and fakes hopelessly gum up a rational
work process. My first impulse to just to let them be liars and
fakes somewhere else...
Then what on earth makes you think you can insult other people for not
knowing?

Being well-informed, logical, and correct has its advantages...maybe
someday you'll try that path instead of the one you're on...
Either you're a knave or a fool. Which is it?

I'm the brave knight of rational productivity in the kingdom of
BSing fakes...
 
W

Walter Roberson

Really? Seems to work to a few thousandths of a second
here (note that _sleep() is my development package version of
a sleep/wait/delay function for Windows, and CLK_TCK
is the macro for determining the number of seconds from
clock()):

With a slight modification to your program to remove the dos dependancy:

#include <stdio.h> /* required to breathe */
#include <time.h> /* required for clock functions */

int main(void) {
int inc;
clock_t start,end;

for(inc=1;inc<5;inc++) {
printf("Sleeping for %d seconds\n",inc);
start=clock();
sleep(inc);
end=clock();
printf("Slept for %f seconds\n",((double)(end-start)/CLK_TCK));
}
}

$ uname -a
IRIX64 origin 6.5 10151453 IP27
$ ./sleepy
Sleeping for 1 seconds
Slept for 0.000000 seconds
Sleeping for 2 seconds
Slept for 0.000000 seconds
Sleeping for 3 seconds
Slept for 0.000000 seconds
Sleeping for 4 seconds
Slept for 0.000000 seconds

/tmp 1081> uname -a
Linux hydra05 2.6.10-1.770_FC3smp #1 SMP Thu Feb 24 18:36:43 EST 2005 x86_64 x86_64 x86_64 GNU/Linux
/tmp 1080> ./sleepy
Sleeping for 1 seconds
Slept for 0.000000 seconds
Sleeping for 2 seconds
Slept for 0.000000 seconds
Sleeping for 3 seconds
Slept for 0.000000 seconds
Sleeping for 4 seconds
Slept for 0.000000 seconds


So Yes, although clock() might have happened to have returned real
time on -your- system, it is defined as returning processor time, and
that is what it actually returns on some very different systems.

The matter is easily resolved by supposing that on your system,
the "system's best approximation of processor time" is clock time.
No big deal; other implementations have better approximations.
 
C

CBFalconer

Keith said:
.... snip ...

Your system unambiguously violates both the standard and its own
documentation (assuming you've been giving us accurate information).
If I were you, I'd complain to your vendor about it. But then again,
if I were you I'd try not to be such a rude long-winded blithering
idiot.

Er, aren't there laws against recommending suicide?
 
M

Mark McIntyre

Being well-informed, logical, and correct has its advantages...

It does. However since you above admitted you aren't well informed,
you seem to be hoist by your own petard.
I'm the brave knight of rational productivity in the kingdom of
BSing fakes...

You are Karl the Chair, and I claim my five pounds.
--
Mark McIntyre

"Debugging is twice as hard as writing the code in the first place.
Therefore, if you write the code as cleverly as possible, you are,
by definition, not smart enough to debug it."
--Brian Kernighan
 

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,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top