Creating Passionate Users
Friday, January 27th, 02006If you create software-driven user services (or maybe even just if you're in business - period), reading Creating Passionate Users should be a requirement.
If you create software-driven user services (or maybe even just if you're in business - period), reading Creating Passionate Users should be a requirement.
Today in operating systems class, the following question came up:
Does a Linux child process get a copy of its parent's stack?
I said yes, based on the rationale that child processes couldn't return from nested function calls without copies of their parent's stack.
I built the following experiment to find out what really happens. The results seem to indicate that I was right...
Code (forkexample.c):
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <sys/wait.h>
void foo(void);
void bar(void);
void biz(void);
pid_t child_pid;
int main(int argc, char *argv[])
{
pid_t pid;
int child_exit_status;
foo();
printf("Both parent & child should get here - PID: %d\n", getpid());
if(getpid() == child_pid)
{
return 0; /* only the child exits here */
}
/* block until child returns */
pid = waitpid(child_pid, &child_exit_status, WNOHANG);
printf("Only parent should be here - PID: %d\n", getpid());
return 0;
}
void foo(void)
{
printf("Entering foo() as PID: %d\n", getpid());
bar();
printf("Exiting foo() as PID: %d\n", getpid());
}
void bar(void)
{
printf("Entering bar() as PID: %d\n", getpid());
biz();
printf("Exiting bar() as PID: %d\n", getpid());
}
void biz(void)
{
printf("Entering biz() as PID: %d\n", getpid());
if ((fork() == 0))
{
child_pid = getpid();
printf("I am the child. PID: %d\n", getpid());
}
else
{
printf("I am the parent. PID: %d\n", getpid());
}
printf("Exiting biz() as PID: %d\n", getpid());
}
Compile:
gcc -Wall forkexample.c -o forkexample
Run:
$ ./forkexample Entering foo() as PID: 12084 Entering bar() as PID: 12084 Entering biz() as PID: 12084 I am the child. PID: 12085 Exiting biz() as PID: 12085 Exiting bar() as PID: 12085 Exiting foo() as PID: 12085 Both parent & child should get here - PID: 12085 I am the parent. PID: 12084 Exiting biz() as PID: 12084 Exiting bar() as PID: 12084 Exiting foo() as PID: 12084 Both parent & child should get here - PID: 12084 Only parent should be here - PID: 12084
As you can see, the child process successfully rolls back the call stack - way past the function it was forked in. It seems to me that this would be impossible, if it didn't have a copy of its parent's stack.
If you're interested in South Dakota, South Dakota Magazine has a great blog. Works well as a marketing piece too, 'cause I just couldn't resist subscribing to their magazine.
It also led me to this South Dakota blog aggregator, which can lead you to a lot of other SD content.
Also, the Tour de Kota is looking like a strong possibility for 2006.
You know those pictures that are made of of a bunch of smaller pictures? It turns out they're quite easy to make with the right software, and I'm thinking one of these things made with the right collection of personally important photos could make a very nice large scale print. I've some initial exploration with AndreaMosaic (free software) and come up with the following picture of Spenser made up of lots of different pictures from last year's RAGBRAI:
|
|
| Original | Mosaic |
Lot's things to experiment with in the future...
Update #1: Beef bites on my style
Update #2: I bite back
Yesterday was a joyous day...
|
| The package I had been anticipating for more than a week arrived |
|
| ...and the precious shipment was revealed |
|
| ...and another case of Guyank was unpacked and carefully ensconced on my pantry shelves |
The Guyank Brand "Original Sweet-HOT Pepper Sauce" is truly the world's greatest hot sauce. I use some of the spicy and savory goodness every day, and you should too.
It receives my very highest recommendation.
See here for details.
Yesterday I took a strenuous 5 hour hike up Embudo Canyon to Oso Pass and back. It's really an amazing thing to have the opportunity to walk out your front door and then damn near all the way up a significant mountain.
This hike was basically the first half of sandiahiking.com's Embudo, Post Pass, Three Gun Spring Trails, Whitewash Route (map), except I started on foot from my house and hiked along the Open Space north of Rebonito, getting onto the trail ASAP and bypassing the Indian School trail head.
If you look at the map, this is pretty close to the waypoints MENLPK -> INSCPK -> EMB365 -> EMBWP1 -> EMBWP1 -> EMBWP2 -> EMBWP3 -> EMBWP4 -> EMBPOS -> POSTPS -> EMBPOS -> EMBTGS -> OSOPSS (and back).
I found the waypoints provided at sandiahiking.com to be an invaluable aid in navigating from the later part of Embudo trail through the major switchbacks and to the intersection with the Post Pass trail, as I lost the trail a few times. After that point, the trail was very well worn to Three Gun Spring trail and onward to Oso pass.
|
| View of Embudo Canyon and Albuquerque at Post Pass |
|
|
| Views of Sandia South Peak from Post Pass |
|
|
| Intersection of Embudo Trail and Three Gun Spring Trail Waypoint EMBTGS: N 35 ° 6.206'; W 106° 26.556'; 7,925 ft |
|
|
|
| Self portraits at EMBTGS | |
|
|
| Towards Oso Pass on Three Gun Spring Trail | |
|
|
| Oso Pass Waypoint OSOPSS: N 35° 7.065'; W 106° 26.596'; 8,442 ft Snow Near Oso Pass |
|
The k-raddest part of the hike was that I did it all on foot - no car ride to a trail head. Highly recommended!
As noted by themfwic, the amount of traffic I'm receiving from people sharing their experiences with broken bone trauma is getting a little out of porportion.
Thankfully, I'm well beyond my own injury. As a result, I'm no longer very interested in the topic, but I don't have the heart to disable comments on the related posts either, as this would shutdown a small torrent of potentially valuable activity; it might be helping people, and it's certainly not hurting anyone after all. So, best of luck to all who are suffering from an injury, and welcome to bohnsack.com!
Maybe I need to start another blog at a new domain name and leave this site as a forum dedicated to broken bones?...
This is the second email I've recieved from UNM warning me that I'll be disenrolled, unless I come up with the scary sum of $0.00. I've paid for next semester in full, but their notification script "isn't featureful enough" to check for a balance before SPAMing me:
NOTIFICATION of REQUIRED PAYMENT BOHNSACK, MATTHEW P This is just a reminder that the "Required Payment" listed below must be received in the Bursar's Office by 5:00 P.M. on 01/06/06. You may pay your disenrollment balance and any other charges on your student account using I-TEL-UNM for the web at https://itel.unm.edu or I-TEL-UNM for the phone at (505) 246-2020. Due to extremely high volume, we strongly recommend that you pay your tuition and fees before the Disenrollment deadline date (Fri, Jan 6th). Any unpaid intersession tuition charges will be included in your disenrollment balance. Total Charges: $ 0.00 Anticipated Financial Aid or Scholarships: $ 0.00 Required Payment: $ 0.00 The "Total Charges" amount listed above includes charges incurred as of 01/03/06. An increase in the number of registered hours or a reduction in "Anticipated Financial Aid" may increase your "Required Payment" amount. Check I-TEL-UNM for new totals. Payment or payment arrangements (promissory note) must be made with the Bursar's office to avoid disenrollment. ...
(emphasis mine)
Perhaps I'm being too sensitive. Do normal people like receiving this kind of pointless email?