Click here to Skip to main content
15,883,705 members

The Weird and The Wonderful

   

The Weird and The Wonderful forum is a place to post Coding Horrors, Worst Practices, and the occasional flash of brilliance.

We all come across code that simply boggles the mind. Lazy kludges, embarrassing mistakes, horrid workarounds and developers just not quite getting it. And then somedays we come across - or write - the truly sublime.

Post your Best, your worst, and your most interesting. But please - no programming questions . This forum is purely for amusement and discussions on code snippets. All actual programming questions will be removed.

 
GeneralGDMA on the ESP32S3 Pin
honey the codewitch18-Mar-23 8:29
mvahoney the codewitch18-Mar-23 8:29 
GeneralRe: GDMA on the ESP32S3 Pin
raddevus18-Mar-23 12:45
mvaraddevus18-Mar-23 12:45 
GeneralRe: GDMA on the ESP32S3 Pin
honey the codewitch18-Mar-23 12:52
mvahoney the codewitch18-Mar-23 12:52 
GeneralRe: GDMA on the ESP32S3 Pin
raddevus18-Mar-23 12:59
mvaraddevus18-Mar-23 12:59 
GeneralRe: GDMA on the ESP32S3 Pin
honey the codewitch18-Mar-23 13:31
mvahoney the codewitch18-Mar-23 13:31 
GeneralI must be doing something wrong... Pin
PIEBALDconsult17-Mar-23 13:47
mvePIEBALDconsult17-Mar-23 13:47 
GeneralRe: I must be doing something wrong... Pin
0x01AA17-Mar-23 14:31
mve0x01AA17-Mar-23 14:31 
GeneralRe: I must be doing something wrong... Pin
trønderen17-Mar-23 14:57
trønderen17-Mar-23 14:57 
A study mate of mine went to a job to implement, or rather port, a database system on the VAX. What they had for development and testing was a 730, probably the slowest VAX ever manufactured. They put a large, green "Turtle Wax" sticker on its front panel.

My good friend timed a couple operations: To blank fill an 80 character buffer before reading an input to it took, for blank filling alone, 20 milliseconds. No, not microseconds, but milliseconds. A process switch (I am quite sure they were running VAX VMS; I don't think any alternative was available in 1983) took 100 ms., i.e. 1/10 of a second.

This DBMS was designed as three processes with a lot of interaction between them. Or, rather, as much as was possible given that process switch time. That wasn't a lot! They had to chop one of the processes into pieces and distribute it on the two other processes, so that the interacting parts were (at least to a much higher degree) running in the same process with no process switch necessary. I don't know the details of how they did it, but suspect that they used a home-made coroutine switching, just loading the stack pointer and program counter of the communication partner to have the message processed. (The project leader was a professor of compiler construction, well versed in register and stack management.)

So the answer is sometimes not to increase the number of threads/processes, but exactly the opposite!

If you task is 100% CPU bound, and only 1 CPU is available, then introducing the overhead of thread switching will never speed up things. On the other hand, you rarely see 100% CPU bound tasks, and nowadays, you rarely see a machine with only 1 CPU available. For the VAX 730, it seemed like you had significantly less than 1 CPU available Smile | :)
GeneralRe: I must be doing something wrong... Pin
PIEBALDconsult17-Mar-23 16:05
mvePIEBALDconsult17-Mar-23 16:05 
GeneralRe: I must be doing something wrong... Pin
trønderen17-Mar-23 17:17
trønderen17-Mar-23 17:17 
GeneralRe: I must be doing something wrong... Pin
PIEBALDconsult18-Mar-23 6:15
mvePIEBALDconsult18-Mar-23 6:15 
GeneralRe: I must be doing something wrong... Pin
GuyThiebaut19-Mar-23 22:02
professionalGuyThiebaut19-Mar-23 22:02 
GeneralRe: I must be doing something wrong... Pin
Daniel Pfeffer19-Mar-23 23:07
professionalDaniel Pfeffer19-Mar-23 23:07 
GeneralRe: I must be doing something wrong... Pin
PIEBALDconsult20-Mar-23 2:50
mvePIEBALDconsult20-Mar-23 2:50 
GeneralRe: I must be doing something wrong... Pin
Daniel Pfeffer20-Mar-23 4:26
professionalDaniel Pfeffer20-Mar-23 4:26 
GeneralRe: I must be doing something wrong... Pin
Bohdan Stupak19-Apr-23 4:31
professionalBohdan Stupak19-Apr-23 4:31 
GeneralChatGPT "solves" a riddle for me. Pin
GKP199212-Mar-23 22:15
professionalGKP199212-Mar-23 22:15 
GeneralRe: ChatGPT "solves" a riddle for me. Pin
Jörgen Andersson13-Mar-23 0:13
professionalJörgen Andersson13-Mar-23 0:13 
GeneralRe: ChatGPT "solves" a riddle for me. Pin
Ron Anders13-Mar-23 1:45
Ron Anders13-Mar-23 1:45 
GeneralRe: ChatGPT "solves" a riddle for me. Pin
jschell20-Mar-23 7:03
jschell20-Mar-23 7:03 
GeneralRe: ChatGPT "solves" a riddle for me. Pin
PIEBALDconsult13-Mar-23 5:34
mvePIEBALDconsult13-Mar-23 5:34 
GeneralRe: ChatGPT "solves" a riddle for me. Pin
PIEBALDconsult13-Mar-23 13:34
mvePIEBALDconsult13-Mar-23 13:34 
GeneralRe: ChatGPT "solves" a riddle for me. Pin
adriancs6-Apr-23 1:15
mvaadriancs6-Apr-23 1:15 
GeneralRe: ChatGPT "solves" a riddle for me. Pin
adriancs6-Apr-23 1:26
mvaadriancs6-Apr-23 1:26 
GeneralRe: ChatGPT "solves" a riddle for me. Pin
DrWalter PE26-Apr-23 18:38
professionalDrWalter PE26-Apr-23 18:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.