Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Locked thread
Bloody
Mar 3, 2013

c thread s: look like they should be workin and they compile but then i run it and it just pegs 1 cpu instead of many cpus

UPDATE: is now segfaulting when the thread is joined

UPDATE: everything is awful

Bloody fucked around with this message at 05:32 on Sep 4, 2013

Adbot
ADBOT LOVES YOU

uG
Apr 23, 2003

by Ralp
im the artisanal bespoke threads

Bloody
Mar 3, 2013

dont worry theyre terrible

Doc Block
Apr 15, 2003
Fun Shoe
just use Grand Central Dispatch aka libdispatch. easy multithreading for the majority of what people use threads for.

Bloody
Mar 3, 2013

i like the part where nobody reads any words i say except for "thread"

Bloody
Mar 3, 2013

any actual progress is p definitely gonna require more serious refactoring though and gently caress that for now

Star War Sex Parrot
Oct 2, 2003

Bloody posted:

i like the part where nobody reads any words i say except for "thread"
you say anything other than "gas"?

FamDav
Mar 29, 2008
heres the basic outline of your code if you would just stop being ridiculous and use c++11

code:

vector<future<result>> results;

for (some iterable that splits up work)
{
	results.push_back(async([=] { code for a particular thread to run; }));
}

for ( auto&& r : results) r.wait() // so i can make sure all of my tasks have completed

// do stuff with results

Posting Principle
Dec 10, 2011

by Ralp
keep in mind if you're using std::async that the stdlibc++ version will always choose to execute in the same thread unless you actually give it the std::launch::async policy

GameCube
Nov 21, 2006

if it's truly embarrassingly parallel use openmp

Nomnom Cookie
Aug 30, 2009



use python. the GIL means python is inherently thread-safe

a cyberpunk goose
May 21, 2007

Nomnom Cookie posted:

use python. the GIL means python is inherently thread-safe

use stackless python :getin:

a cyberpunk goose
May 21, 2007

but no really stackless python is hells of sweet, you run functions as tasklets and they perform work and you can "yield" or "imbalance" that tasklet at any time and it'll halt execution and move on to the next one

it don't seem like much but it's neat for game programming because you can have an AI's think() function just run in an infinite while true: loop and yield() after it's done thinking, or if it needs to think more you just dont yield and keep looping, and you can set some watchdog parameters that dont let a tasklet run for more than X instructions before forcing execution onto the next thread

so its a good way to say, like, some_result = watchdog.run( game_object.solve_path_to(some_point) )
and maybe that solve_path_to will just run for a while without making all your poo poo lag

EVE uses it to make their servers run less like poo poo

edit:
babby's first concurrency model

Posting Principle
Dec 10, 2011

by Ralp
i thought stackless wasn't maintained anymore?

a cyberpunk goose
May 21, 2007

wouldn't surprise me if it isn't

still had a lot of fun when i used it for some nerdlinger game project test engine thingy :shobon:

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Mido posted:

but no really stackless python is hells of sweet, you run functions as tasklets and they perform work and you can "yield" or "imbalance" that tasklet at any time and it'll halt execution and move on to the next one

it don't seem like much but it's neat for game programming because you can have an AI's think() function just run in an infinite while true: loop and yield() after it's done thinking, or if it needs to think more you just dont yield and keep looping, and you can set some watchdog parameters that dont let a tasklet run for more than X instructions before forcing execution onto the next thread

so its a good way to say, like, some_result = watchdog.run( game_object.solve_path_to(some_point) )
and maybe that solve_path_to will just run for a while without making all your poo poo lag

EVE uses it to make their servers run less like poo poo

edit:
babby's first concurrency model

Yay coroutines

power botton
Nov 2, 2011

you should just use node then. does the same poo poo and is actually maintained, unlike python

Elder Postsman
Aug 30, 2000


i used hot bot to search for "teens"

hey can anyone recommend a good babbys first sql book?

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
http://www.amazon.com/gp/aw/d/1593271905

uG
Apr 23, 2003

by Ralp

im going to allow this

CamH
Apr 11, 2008

wtf

Workaday Wizard
Oct 23, 2009

by Pragmatica
hey guys i am thinging of writing a uefi-enabled x86_64 hobby os (NOT SEROIOUS!!).

what's a good free resource for os dev information? i need info on how to interface with the hardware.
i know that hal, acpi,... are things but i don't know how to begin to work on implementing them

i looked at osdev.org and it's full of outdated/wrong information and lovely alpha nerds.

help a brother out

PS: i am looking at the linux kernel and while it's very helpful it has a long history and i am kinda looking at the end result without any sense of context

Nomnom Cookie
Aug 30, 2009



Mido posted:

but no really stackless python is hells of sweet, you run functions as tasklets and they perform work and you can "yield" or "imbalance" that tasklet at any time and it'll halt execution and move on to the next one

it don't seem like much but it's neat for game programming because you can have an AI's think() function just run in an infinite while true: loop and yield() after it's done thinking, or if it needs to think more you just dont yield and keep looping, and you can set some watchdog parameters that dont let a tasklet run for more than X instructions before forcing execution onto the next thread

so its a good way to say, like, some_result = watchdog.run( game_object.solve_path_to(some_point) )
and maybe that solve_path_to will just run for a while without making all your poo poo lag

EVE uses it to make their servers run less like poo poo

edit:
babby's first concurrency model

actually eve is running away from python as fast as they can because they want the servers to not run like poo poo

CamH
Apr 11, 2008

I recommend using basic. It's nice and simple and low level because it's so basic

Elder Postsman
Aug 30, 2000


i used hot bot to search for "teens"


uh that looks like anime to me, i'm not sure i want that on my bookshelves

Zlodo
Nov 25, 2006

Nomnom Cookie posted:

actually eve is running away from python as fast as they can because they want the servers to not run like poo poo

the eve client is also written mostly in python (with all the low level rendering engine etc. written in c++ master race)

it's possible to run the entire client through a decompiler and modify it
people making all those mining bots just build upon the autopilot code and make their own ingame configuration UIs etc.

basically lol eve online

----------------
This thread brought to you by a tremendous dickhead!

Bloody
Mar 3, 2013

Zlodo posted:

the eve client is also written mostly in python (with all the low level rendering engine etc. written in c++ master race)

it's possible to run the entire client through a decompiler and modify it
people making all those mining bots just build upon the autopilot code and make their own ingame configuration UIs etc.

basically lol eve online

ask me about my successful career as an eve online automation enthusiast

a cyberpunk goose
May 21, 2007

Nomnom Cookie posted:

actually eve is running away from python as fast as they can because they want the servers to not run like poo poo

oh i know

and they should

i just really enjoyed it :3:

~Coxy
Dec 9, 2003

R.I.P. Inter-OS Sass - b.2000AD d.2003AD

dur posted:

hey can anyone recommend a good babbys first sql book?

not trying to be snarky but what could a beginner sql book teach you that isn't already immediately intuitive

and anyway just use an ORM

prefect
Sep 11, 2001

No one, Woodhouse.
No one.




Dead Man’s Band

~Coxy posted:

not trying to be snarky but what could a beginner sql book teach you that isn't already immediately intuitive

and anyway just use an ORM

are orms a good idea if you're working on something where the database performance becomes important?

Nomnom Cookie
Aug 30, 2009



orms are always a good idea bc if you let your coworkers have a raw connection they'll never do anything but stringbuilder some sql

Elder Postsman
Aug 30, 2000


i used hot bot to search for "teens"

~Coxy posted:

not trying to be snarky but what could a beginner sql book teach you that isn't already immediately intuitive

and anyway just use an ORM

i don't know, i guess that's kind of part of why i'm asking? i don't know what an ORM is but i guess i'll google it.

Impromptu Flip
Aug 30, 2008
does anyone use a (osx) program to manage code snippets? i, terrible programmer, find myself wanting to reuse bits of code more and more these days. i've heard good things about Dash and Snippets, and i'e seen Codebox on the app store which looks alright. tell me the proest choice, yospos.

uG
Apr 23, 2003

by Ralp

Nomnom Cookie posted:

orms are always a good idea bc if you let your coworkers have a raw connection they'll never do anything but stringbuilder some sql

uG
Apr 23, 2003

by Ralp
you need a program for reusing bits of code?

Shaggar
Apr 26, 2006

prefect posted:

are orms a good idea if you're working on something where the database performance becomes important?

no. use a statement mapper

Elder Postsman
Aug 30, 2000


i used hot bot to search for "teens"

Impromptu Flip posted:

does anyone use a (osx) program to manage code snippets? i, terrible programmer, find myself wanting to reuse bits of code more and more these days. i've heard good things about Dash and Snippets, and i'e seen Codebox on the app store which looks alright. tell me the proest choice, yospos.

i use google docs and have a text file with code bits each under a heading that describes the code so i can generate a table of contents and easily jump to the one i want

Impromptu Flip
Aug 30, 2008

uG posted:

you need a program for reusing bits of code?

going through projects to find things i want is getting cumbersome, there's got to be a better way!!!

searching throug snippets seems like it would be easy & convenient

dur posted:

i use google docs and have a text file with code bits each under a heading that describes the code so i can generate a table of contents and easily jump to the one i want

that sounds p ghetto but the toc is a good idea

i'll try out dash, i looks like it just nags you if you don't pay

power botton
Nov 2, 2011

Impromptu Flip posted:

does anyone use a (osx) program to manage code snippets? i, terrible programmer, find myself wanting to reuse bits of code more and more these days. i've heard good things about Dash and Snippets, and i'e seen Codebox on the app store which looks alright. tell me the proest choice, yospos.

text expander

Adbot
ADBOT LOVES YOU

power botton
Nov 2, 2011

comedy option: some lovely vim plugin that takes years to become useful

  • Locked thread