Poll System Call Sample Cover Letter

5 election jobs that might be just the ticket for you

Do your civic duty—and get paid for it—with these positions.

Election season is upon us. For full- and part-time job seekers with a penchant for politics, employment opportunities are in high supply.

“Most local agencies roughly double in size about three to six months before the election with temp workers,” says Eric Olsen, election training coordinator at the D.C. Board of Elections.

Nonetheless, many positions require candidates to pass a quiz that tests their competency in the specific job function, and essentially all jobs require top-notch attention to detail. “Our election procedures have to be flawless,” says Kristin Reed, manager of administration services at the Orange County Registrar of Voters in California. “There is zero tolerance for errors.”

Given the industry’s tight deadlines, time management skills are crucial. “We want workers who are self-starters—people who don’t need hand-holding,” says Olsen. Hiring managers also want people who thrive in an election’s fast-paced work environment, says Nikki Charlson, deputy state administrator at Maryland's State Board of Elections.

These full- and part-time election jobs* could be just the ticket for your skills and passion.

Poll worker (part-time)

What they do: Oversee the polling site on Election Day by fulfilling duties such as issuing ballots to registered voters, monitoring the voting equipment, and instructing voters how to mark the ballot. Many jurisdictions require poll workers to work a 12- to 14-hour day.

Education requirements: Must be a registered voter in the county in which the municipality is located, pass a basic training course, and speak, read, and write fluently in English.

Median pay: Compensation for poll workers varies by county and state, but they earn on average $150 to $250 for Election Day, says Olsen.

How you know you’re the right fit: Since the pay is low and the hours are long, you need to be passionate about the cause, says Charlson. “[Poll workers] are truly dedicated public servants,” she says.

Election communications coordinator (full-time)

What they do: Manage internal communications and run media relations by writing public information packages, news releases, briefing notes, and background reports.

Education requirements: Bachelor’s degree in communications, public relations, or journalism and technical writing experience.

Median pay: Between $31,000 and $55,000 annually, according to PayScale.

How you know you’re the right fit: Without ample media coverage, voter turnout can suffer dramatically. Thus, while mid- and large-size firms in many industries employ a communications coordinator, the role is an integral part in an election office, Olsen says.

Voter outreach coordinator (full-time)

What they do: Organize education efforts with the general public, as well as with niche voters such as senior citizens, college students, and prisoners who are eligible to vote. Many also create video tutorials for online outreach programs.

Education requirements: High school diploma or G.E.D. and clerical work experience.

Median pay: Between $27,000 and $33,000, according to GovernmentJobs.com.

How you know you’re the right fit: Strong communication and customer service skills are a must since you’re interacting directly with voters, says Reed.

Voter translator (part-time)

What they do: Educate voters in foreign languages both leading up to and during Election Day.

Education requirements: Pass a bilingual exam and basic training course.

Median pay: Across the general workforce, translators earn on average $20 per hour, according to PayScale.

How you know you’re the right fit: You have strong communication skills and can break down the complexities of the voting process for foreign-language speakers.

Election technology specialist (full-time)

What they do: Maintain the office’s internal database to keep voters’ personal information secure, fix technological issues, and repair Election Day equipment such as audio ballots.

Education requirements: Bachelor’s degree in the computer technology field and experience with computer systems hardware configuration and setup.

Median pay: Across the general workforce, IT specialists earn between $34,000 and $90,000 annually, according to PayScale.

How you know you’re the right fit: You can troubleshoot quickly and are open to working outside the traditional 9-to-5, since pressing IT issues sometimes crop up on nights and weekends.

*Job titles may vary.

Find election jobs on Monster.

MORE FROM MONSTER:


Motivation

For assignment 3, you have to deal with multiple clients connected at the same time. A natural question, then, is: how can you from multiple file descriptors (sockets) at once? Do you need to make some really annoyingly multi-threaded code to handle each client that's connected? Do you have to go into some stupid loop constantly checking each socket to see if data's available? If you're using Java, the answer is "yes, you have to do things the stupid way" (that's not totally fair: Java actually gives you two stupid ways to do this). But Unix gives us a nicer way to deal with this.

Multiplexing

Every Unix system has some way of multiplexing file descriptors. Sadly we don't have 100% standardization on this front yet. But, the general idea is the same among all the Unices. Be wary of this in case you're developing your code at home on Linux or OS X: make sure you compare the man pages on both systems to ensure your code will work the same way when run on Solaris, which it should for the examples I give here. (Note: some Unix systems do not have a system call at all and use the system call, which accomplishes the same thing in a more annoying manner. I highly recommend you use for your assignments)

The idea behind multiplexing is that the operating system (kernel) knows when data is ready on a socket. You hand the operating system an array of file descriptors and say "tell me when something happens on one of these". Your code blocks (stops executing) until there is data ready for you. At that point, you iterate through your array of file descriptors to determine which one has data ready.

The poll(2) system call

Information can be found by doing a on GAUL. I recommend reading the manpage after reading this document to see the specifics of the system call.

Let's say we had 3 sockets connected, , and . Let's say we're a server and we want to go to sleep until something happens on one of those 3 sockets. The code would look like so:

struct pollfd fds[] = { { s1, POLLIN }, { s2, POLLIN }, { s3, POLLIN } }; int r = poll(fds, 3, 0); if (r < 0) { /* ... there was an error! ... */ } else { int i; for (i = 0; i < 3; i++) if(fds[i].revents & POLLIN) { /* ... socket number i has data waiting!! ... */ } }

So, let's step through it. The system call expects an array of s, so we make that first. In practice, you would fill up this array using a loop since your file descriptors wouldn't be hard coded. For each element in our array, we give a file descriptor and a set of events to watch for. We use the event to stand for "any data that may be read". There is a too (to check if a socket is ready to accept data), but we won't be considering that.

We then call . We give it a pointer to our array, the size of our array, and optionally a pointer to timeout information (in case we don't want to block forever). I'm giving a null pointer here indicating that we don't ever want to time out.

So will block until something happens on one of those 3 file descriptors. When it returns, it will have modified the array of structs we gave it! Namely, the (standing for "returned events") field will be filled in.

To determine which file descriptor we should be caring about, we iterate through our array and check the field for each. If the event is set, we know there's data waiting there!

Side note on why I'm using the & operator

It's a very common idiom in C to use bitmasks to indicate a set of boolean values. I know, you thought you'd avoided bits after dealing with assignment 2. Well, you can ignore this section if you want (and just use the code above), but bits are really your friend :)

For the sake of argument, let's say dealt with values of , and (in the real world actually deals with a lot more possible values). In the code above, we said that we want to watch for events. What if want to watch for and events?

What the implementors of could do is set:

#define POLLIN 1 #define POLLOUT 2 #define POLLERR 4

If you look at those 3 values (1, 2 and 4) in binary, you'll see each has exactly one bit set. If we want to watch for both and , we can say . I.e., we do a bitwise OR between them. We get a value of 5. 5 has two bits set (1 and 4) indicating we want both and .

The benefit of this is we can store 32 (or 64 on a 64-bit machine) different boolean values in a single integer. Cool!

When it comes time to check values in we do the same thing. Instead of setting bits, we check bits. may have bits set in it that we don't care about: all we care about are the bits. So we mask the return value with (by doing a bitwise AND) to see if those bits are set.

That is why I say .

Adding in a listening socket

At this point you should be saying, "Mike, this is the greatest thing I've ever heard of in the history of mankind, but my server doesn't just have to listen for data: it has to listen for new connections as well!"

I reply to you, "do not doubt the power of ."

A listening socket is just a file descriptor, like any other socket. We can change our code above to deal with a listening socket:

struct pollfd fds[] = { { listening_socket, POLLIN }, { s1, POLLIN }, { s2, POLLIN }, { s3, POLLIN } }; int r = poll(fds, 4, 0); if (r < 0) { /* ... there was an error! ... */ } else { int i; /* first we check the listening socket */ if (fds[0].revents & POLLIN) { /* there's a new connection */ /* do code here involving "accept" */ } /* next we check our already-connected sockets */ for (i = 1; i < 4; i++) if(fds[i].revents & POLLIN) { /* ... socket number i has data waiting!! ... */ /* do code here involving "read" */ } }

The only trick here is we have to know which socket in our array is a listening socket and which are already-connected sockets.

0 comments

Leave a Reply

Your email address will not be published. Required fields are marked *