2015 WDWMagic Imagineering Competition Videos: Your Official "Hub" Thread

JokersWild

Well-Known Member
It's not that hard:

Code:
double const thinking_to_eating = 0.02;
double const eating_to_thinking = 0.05;

void eat(int phil_id){
  fprintf(stdout,"Philosopher %d eats\n", phil_id);
  while (rand() / (RAND_MAX + 1.0) >= eating_to_thinking);
}

void think(int phil_id){
  fprintf(stdout,"Philosopher %d thinks\n", phil_id);
  while (rand() / (RAND_MAX + 1.0) >= thinking_to_eating);
}

pthread_mutex_t servings_mutex;
int servings;

void* philosodine(void* arg){
  intptr_t phil_id;

  phil_id = (intptr_t) arg;

  while(1){
    /* Philosopher gets served */
    pthread_mutex_lock(&servings_mutex);
    if(servings <= 0){
      pthread_mutex_unlock(&servings_mutex);   
      break;
    }
    else{
      servings--;
      pthread_mutex_unlock(&servings_mutex);   
    }

    /* Picks up his chopsticks */
    pickup_chopsticks(phil_id);

    /* Eats */
    eat(phil_id);

    /* Puts down his chopsticks */
    putdown_chopsticks(phil_id);

    /* And then thinks. */
    think(phil_id);
  }

  return NULL;
}

int main(){
  long i;
  pthread_t phil_threads[5];

  srand(time(NULL));

  pthread_mutex_init(&servings_mutex, NULL);
  servings = 1000;

  for(i = 0; i < 5; i++)
    pthread_mutex_init(&chopstick_mutex[i], NULL);

  for(i = 0; i < 5; i++)
    pthread_create(&phil_threads[i], NULL, philosodine, (void*) i);

  for(i = 0; i < 5; i++)
    pthread_join(phil_threads[i], NULL);  

  for(i = 0; i < 5; i++)
    pthread_mutex_destroy(&chopstick_mutex[i]);

  return 0;
}


Also good luck in College @JokersWild

This is why I'm a film major :p

And thanks!
 

englanddg

One Little Spark...
Tomorrow night
39dc8d25.gif
 

LittleGiants16

Well-Known Member
Speaking of political science, I can't help but ask how is it? Do you like it? Complaints? Compliments?
Personally, I love what I study. A good political science curriculum is a nice mix of civics, psychology, sociology, and philosophy. It's a lot of reading, and a lot of writing, but I find it to be very rewarding.

But, I think you have to ask yourself, what questions do you, as a student, want to answer. If you want to understand and investigate why voter apathy in certain precincts leads to poor returns for one party or the other, political science is great. If you want to talk about issues and your personal views, then move along. As a political scientist, your views don't matter. All that matters is the question at hand.
 

englanddg

One Little Spark...
Personally, I love what I study. A good political science curriculum is a nice mix of civics, psychology, sociology, and philosophy. It's a lot of reading, and a lot of writing, but I find it to be very rewarding.

But, I think you have to ask yourself, what questions do you, as a student, want to answer. If you want to understand and investigate why voter apathy in certain precincts leads to poor returns for one party or the other, political science is great. If you want to talk about issues and your personal views, then move along. As a political scientist, your views don't matter. All that matters is the question at hand.
 

Sam Magic

Well-Known Member


Personally, I love what I study. A good political science curriculum is a nice mix of civics, psychology, sociology, and philosophy. It's a lot of reading, and a lot of writing, but I find it to be very rewarding.

But, I think you have to ask yourself, what questions do you, as a student, want to answer. If you want to understand and investigate why voter apathy in certain precincts leads to poor returns for one party or the other, political science is great. If you want to talk about issues and your personal views, then move along. As a political scientist, your views don't matter. All that matters is the question at hand.
I thank you both for those comments and the video. All are very helpful.

I'm trying to pick my major and minor and now it is down between either economics or law and for my minor something like western history. Still I was looking into varying types of political studies.
 

englanddg

One Little Spark...
I thank you both for those comments and the video. All are very helpful.

I'm trying to pick my major and minor and now it is down between either economics or law and for my minor something like western history. Still I was looking into varying types of political studies.
For law school there is absolutely no reason to limit your undergrad pursuits to a standard pre-law track. Political science is a nice general basis, as one example. My point is, and my advice, use your undergrad to help specialize and define the type of law you wish to pursue, and or make you a better litigator (hence why a english or speech major focusing on rhetoric works well for that, too).
 

LittleGiants16

Well-Known Member
For law school there is absolutely no reason to limit your undergrad pursuits to a standard pre-law track. Political science is a nice general basis, as one example. My point is, and my advice, use your undergrad to help specialize and define the type of law you wish to pursue, and or make you a better litigator (hence why a english or speech major focusing on rhetoric works well for that, too).
I'm a double minor in rhetoric and business. And, for me, the pre-law track came after I declared my major. I've always been fascinated by governmental and function. So, for me, the desire to be a poli sci major came first.

On a side note, as strange as it sounds, the obscurities of federal and state code also fascinate me.
 

englanddg

One Little Spark...
I'm a double minor in rhetoric and business. And, for me, the pre-law track came after I declared my major. I've always been fascinated by governmental and function. So, for me, the desire to be a poli sci major came first.

On a side note, as strange as it sounds, the obscurities of federal and state code also fascinate me.
Sounds well rounded to me! The thing that always surprises new lawyers (according to my father, who is one, not me...I'm an IT nerd) is how varied, and often specialized, the field of law is. He has a whole presentation he used to give to alumns for the association back in the day about it for recent undergrads looking to pursue law school.
 

Voxel

President of Progress City
Sounds well rounded to me! The thing that always surprises new lawyers (according to my father, who is one, not me...I'm an IT nerd) is how varied, and often specialized, the field of law is. He has a whole presentation he used to give to alumns for the association back in the day about it for recent undergrads looking to pursue law school.
New lawyers/law students are also finding it difficult to find jobs, the market is a bit flooded. Like many careers the retirement age is going up and the number of new individuals are far greater then the number of theses retiring. I have friends and DC and Baltimore who had to go more into the out there law related friends because they couldn't find a lawyer position
 

englanddg

One Little Spark...
New lawyers/law students are also finding it difficult to find jobs, the market is a bit flooded. Like many careers the retirement age is going up and the number of new individuals are far greater then the number of theses retiring. I have friends and DC and Baltimore who had to go more into the out there law related friends because they couldn't find a lawyer position
There's always JAG. :p
 

Register on WDWMAGIC. This sidebar will go away, and you'll see fewer ads.

Back
Top Bottom