this post was submitted on 26 Sep 2024
642 points (95.9% liked)

Funny

6598 readers
1405 users here now

General rules:

Exceptions may be made at the discretion of the mods.

founded 1 year ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] Honytawk@lemmy.zip 29 points 1 day ago

Is his PhD in Electrical Engineering?

[–] Aceticon@lemmy.world 30 points 1 day ago* (last edited 1 day ago) (2 children)

Well, I have an EE Degree specialized in Digital Systems - pretty much the opposite side of Electronic Engineering from the High Power side - and I would be almost as clueless as that guy when it comes to testing a 10,000V fence for power.

On the other hand I do know a lot of interesting things about CPU design ;)

[–] curiousaur@reddthat.com 3 points 20 hours ago (1 children)
[–] dellish@lemmy.world 2 points 14 hours ago

You didn't say the magic word

[–] dependencyinjection@discuss.tchncs.de 8 points 1 day ago (1 children)

What’s the most interesting thing you could tell us about CPU design, something that a layman could appreciate.

You should know as a software developer I write inefficient code and appreciate all the extra clock cycles we get these days haha.

[–] Aceticon@lemmy.world 28 points 1 day ago* (last edited 1 day ago)

First a fair warning: I learned this stuff 3 decades ago and I've actually been working as a programmer since then. I do believe the example I'll provide still applies up to a point, though CPUs often implement strategies to make this less of a problem.

=====

CPU's are internally like an assembly line or a processing pipeline, were the processing of an assembly instruction is broken down into a number of steps. A rough example (representative but not exactly for any specific CPU architecture) would be:

  • Step 1: fetch assembly instruction from memory
  • Step 2: fetch into the CPU data in memory that the instruction requires (if applicable).
  • Step 3: execute arithmetic or binary operation (if applicable).
  • Step 4: evaluate conditions (if applicable)
  • Step 5: write results to memory (if applicable)

Now, if the CPU was waiting for all the steps to be over for the processing of an assembly opcode before starting processing of the next, that would be quite a waste since for most of the time the functionality in there would be available for use but not being used (in my example, the Arithmetic Processing Unit, which is what's used in step #3, would not be used during the time when the other steps were being done).

So what they did was get CPUs to process multiple opcodes in parallel, so in my example pipeline you would have on opcode on stage #1, another that already did stage #1 and is on stage #2 and so on, hence why I also called it an assembly line: at each step a "worker" is doing some work on the "product" and then passing it to the next "worker" which does something else on it and they're all working at the same time doing their thing, only each doing their bit for a different assembly instruction.

The problem with that technique is: what happens if you have an opcode which is a conditional jump (i.e. start processing from another point in memory if a condition is valid: which is necessary to have to implement things like a "for" or "while" loop or jumping over of a block of code in an "if" condition fails)?

Remember, in the my example pipeline the point at which the CPU finally figures out if it should jump or not is almost at the end of the pipeline (step #4), so everything before that in the pipeline might be wrong assembly instructions being processed because, say, the CPU assumed "no-jump" and kept picking up assembly instructions from the memory positions after that conditional-jump instruction but it turns out it does have to jump so it was supposed to be processing instructions from somewhere else in memory.

The original naive way to handle this problem was to not process any assembly instructions after a conditional jump opcode had been loaded in step #1 and take the processing of the conditional jump through each step of the pipeline until the CPU figured out if the jump should occur or not, by which point the CPU would then start loading opcodes from the correct memory position. This of course meant every time a conditional jump appeared the CPU would get a lot slower whilst processing it.

Later, the solution was to do speculative processing: the CPU tried to guess if it would the condition would be true (i.e. jump) or false (not jump) and load and start processing the instructions from the memory position matching that assumption. If it turned out the guess was wrong, all the contents of the pipeline behind that conditional jump instruction would be thrown out. This is part of the reason why the pipeline is organised in such a way that the result of the work only ever gets written to memory at the last step - if it turns out it was working in the wrong instructions, it just doesn't do the last step for those wrong instructions. This is in average twice as fast as the naive solution (and better guessing makes it faster still) but it still slowed down the CPU every time a conditional jump appeared.

Even later the solution was to do the processing of both branches (i.e. "jump" and "no-jump") in parallel and then once the condition had been evaluated throw out the processing for the wrong branch and keep doing the other one. This solved the speed problem but at the cost of having double of everything, plus had some other implications on things such as memory caching (which I'm not going to go into here as that's a whole other Rabbit Hole)

Whilst I believe modern CPUs of the kind used in PCs don't have this problem (and probably also at least ARM7 and above), I've actually been doing some Shader programming of late (both Computing and Graphics Shaders) and if I interpreted what I read correctly a version of this kind of problem still affected GPUs not that long ago (probably because GPUs work by having massive numbers of processing units which work in parallel, so by necessity they are simple) though I believe nowadays it's not as inadvisable to use "if" when programming shaders as it used to be a few years ago.

Anyways, from a programming point of view, this is the reason why C compilers have an optimization option of doing something called "loop unrolling" - if you have a "for" loop with a fixed number of iterations known at compile time - for example for(int i = 0; i < 5; i++){ /* do stuff */ } - the compiler instead of generating in assembly a single block of code with the contents of the "for" loop and a conditional jump at the end, will instead "unroll the loop" by generating the assembly for the body of the loop as many times as the loop would loop - so in my example the contents of that "for" loop would end up as 5 blocks in assembly each containing the assembly for the contents, one after the other, the first for i=0, the next for i=1 and so on.

As I said, it's been a long time since I've learned this and I believe nowadays general CPUs implement strategies to make this a non-problem, but if you're programming microcontrollers or doing stuff like Compute Shaders to run on GPUs, I believe it's actually the kind of thing you still have to take in account if you want max performance.

Edit: Just remembered that even the solution of doing the parallel execution of both branches doesn't solve everything. For example, what if you have TWO conditional jump instructions one after the other? Theoretically would need almost 4 or everything to handle parallel execution for it. How about 3 conditional jumps? "Is you nested for-loop screwing your performance? More news at 11!". As I said, this kind of stuff is a bit of a Rabbit Hole.

[–] Sam_Bass@lemmy.world 6 points 1 day ago

not a phd in physics huh

He must have skipped all of the Electrical Engineering classes in his Paleontology program.

[–] Th4tGuyII@fedia.io 53 points 1 day ago (3 children)

As someone who has worked with academics, the more specialised the person, the less common sense they seem to hold onto.

As such, if this was outside their PhD specialisation, then it'd absolutely make sense that this wouldn't occur to them.

[–] cynar@lemmy.world 4 points 1 day ago (1 children)

My university basically gave up with a couple of professors. They hired a personal assistant, full time, just to try and keep them organised. They apparently settled on 3 phone calls, to make sure they made lectures on time. It even extended to things like reminding them to actually get their wives birthday presents, and personal book keeping.

It seems the human brain has a capacity limit. The more specialist knowledge shoved in, the less room for more normal knowledge. Eventually it displaces even the most basic common sense.

[–] bleistift2@sopuli.xyz 3 points 1 day ago* (last edited 1 day ago)

Meet the German word Fachidiot: (derogatory) A person who is only interested in their own trade or research area and has few or no other interests or skills.

load more comments (2 replies)
[–] Matriks404@lemmy.world 13 points 1 day ago (3 children)

Hey it's a "It's a UNIX system" movie, isn't it?

[–] JackbyDev@programming.dev 17 points 1 day ago

Did you know the weird 3d file system navigation thingy was a real program (just not widely used)?

But I can't get over the way she held the mouse lol

[–] darklamer@lemmy.dbzer0.com 11 points 1 day ago (1 children)

The funny thing about that quote is that it really was a Unix system that was shown on screen.

[–] MonkderVierte@lemmy.ml 5 points 1 day ago (1 children)

What was the name of the 3D file manager again?

[–] darklamer@lemmy.dbzer0.com 4 points 1 day ago

It had a wonderfully bizarre name: fsn

load more comments (1 replies)
[–] wowwoweowza@lemmy.world 11 points 1 day ago (1 children)

Why people gotta hate on a movie three decades old that remains perfect?

load more comments (1 replies)
[–] Lev_Astov@lemmy.world 98 points 1 day ago* (last edited 1 day ago) (2 children)

At 10kV, a random stick would be all it takes to start an arc. He knows what he's doing.

[–] stupidcasey@lemmy.world 45 points 1 day ago* (last edited 1 day ago) (1 children)

True, True… Hay who thought it was safe to run 10,000V Wire through a flammable overgrown jungle?

load more comments (1 replies)
[–] Aceticon@lemmy.world 4 points 1 day ago* (last edited 1 day ago) (1 children)

I'm genuinelly curious were you got that from.

I actually went and checked the minimum air gap to avoid arcing at 10,000V at standard sea level air pressure and it's actually measured in millimeters.

Further, is the voltage differential there between parallel conducting lines or is it between the lines and the ground?

I'm really having trouble seing how a dry stick would cause arcing between two of those lines short of bringing them nearer than 4 mm in the first case, much less between one of the lines and the ground in the second case if its being held at chest level.

PS: Mind you, it does make sense with a stick which is not dry - since the water in it makes it conductive - but then the guy himself would be part of the conductive circuit, which kinda defeats the point of using a stick.

[–] BearGun@ttrpg.network 4 points 1 day ago

What you want to do is create an arc between the stick and the line, and not have it transfer to you. A dry stick would do this quite well, since it would be at ground voltage and as such would provoke a short arc without electrocuting yourself. The fence also probably doesn't have all that much power, likely can't deliver more than a few amps, so it would be quite safe even.

[–] MehBlah@lemmy.world 16 points 1 day ago (4 children)

He is already standing too close and that stick would arc with that many volts flowing through it. The most likely outcome in reality if it had been energized. The arc would have jumped from the stick to him and no more New Zealand guy.

load more comments (4 replies)
[–] vzq@lemmy.blahaj.zone 208 points 2 days ago (3 children)

As a PhD who has tried doing home improvement projects, it’s the most believable thing in the film.

[–] MadBob@feddit.nl 40 points 2 days ago (2 children)

Actually some of the most naïve people I've ever met were theretofore academically successful.

load more comments (2 replies)
[–] ByteOnBikes@slrpnk.net 24 points 2 days ago (4 children)

Some pleeb shouted at me, "I thought you were an engineer!" And I shouted back, "A software engineer!" while I hammer a nail with my shoe.

[–] calcopiritus@lemmy.world 10 points 1 day ago

Ah, a C programmer.

load more comments (3 replies)
[–] 0x4E4F@sh.itjust.works 21 points 2 days ago* (last edited 2 days ago) (1 children)

Really?

Genuinely asking, I'm just an engineer... with very very bad grades. Passed was enough for me.

Once a professor asked me if I wanted to take the exam again because it was clear that I knew more than what I showed on the exam (a lot of 2 + 2 = 5 mistakes, I was fairly good at that and owe most of my low grades to that). I asked him if I passed, he said yes. Fuck that shit, I'm taking that grade and parading it across town, wooohoo 🥳.

[–] GreenPlasticSushiGrass@moist.catsweat.com 34 points 2 days ago (1 children)

As they say, a PhD is about learning more and more about less and less. Some of the smartest people at conferences I've attended legitimately risk death crossing the street.

load more comments (1 replies)
[–] bjoern_tantau@swg-empire.de 160 points 2 days ago (25 children)

A high voltage electric fence. At some point even standing in front of the thing is enough.

[–] thefartographer@lemm.ee 35 points 2 days ago (5 children)

My arm once got pulled into an electric fence when I was a kid and I couldn't stop getting shocked until someone physically pulled me away. It was more of a self-control issue than accidentally bridging the gap.

That was the day I learned that some pain can be pleasant. The owner of the property didn't seem as pleased with my discovery as I did. He had to shut off the fence and yanked my arm away and then told me to go explore my perversions somewhere else. I was too young to understand the word "perversion," and I'm now eternally grateful to that poor unprepared rancher.

load more comments (5 replies)
load more comments (24 replies)
[–] Badeendje@lemmy.world 7 points 1 day ago (1 children)
[–] Etterra@lemmy.world 2 points 1 day ago

Mythbusters did it.

[–] MalReynolds@slrpnk.net 34 points 2 days ago

I don't remember the scene, but personally I'd test an electric fence with a nonconductor. You'll probably get some sparks but won't die. You do you, ppl in this thread.

[–] SharpieThunderflare@lemmy.ca 59 points 2 days ago (3 children)

IIRC, he was messing with the kids and knew it was off because the lights were off. He proceeded to put his hands on it and convulse wildly as a joke.

load more comments (3 replies)
[–] Damage@feddit.it 42 points 2 days ago (9 children)

Wet wood from the ground is probably a better conductor than dinosaur scales

load more comments (9 replies)
[–] OutlierBlue@lemmy.ca 63 points 2 days ago (8 children)

Just because you're very good at one thing doesn't mean you're good at another. Sometimes the further you go down one path, the less you know about everything else.

load more comments (8 replies)
[–] LEDZeppelin@lemmy.world 51 points 2 days ago (1 children)

Clearly his PhD is not in electrical engineering or biology

[–] The_Picard_Maneuver@lemmy.world 38 points 2 days ago (1 children)

It's actually a PhD in trombone. Someone misheard it one time, and nobody has ever thought to follow up.

"Oh, Alan? Yeah, he has a doctorate in bones or something."

load more comments (1 replies)
[–] billwashere@lemmy.world 11 points 1 day ago (2 children)

Yep. Very domain specific knowledge but couldn’t pour piss outta a boot with the instructions on the heel.

load more comments (2 replies)
load more comments
view more: next ›