Archive

Archive for September, 2007

Unblock Handler

September 21st, 2007 No comments

I had fun writing my first unblock handler in a resource manager. unblock handling is required when clients are currently blocked on a resource manager service and are requesting to be unblocked because of being hit by a signal or other reasons. The kernel will detect that they’d like be unblocked and will send a pulse to the server passing the rcvid and ocb that need to be unblocked and that resource manager can decide what to do with it.

So the reason I was adding this was to support timeouts on the API. This is relatively easy to do from a client API:

struct sigevent api_timeout_event;
api_timeout_event.sigev_notify = SIGEV_UNBLOCK;
api_timeout_value = 100 * 1000 * 1000;  // 100 ms
TimerTimeout(CLOCK_REALTIME, _NTO_TIMEOUT_SEND | _NTO_TIMEOUT_REPLY, &api_timeout_event, &api_timeout_value, &hdl->api_timeout_left);
rc = MsgSend(fd, &msg, sizeof msg.to, NULL, 0);
if (rc == -1 && errno == EINTR) {
	fprintf(stderr, "Interrupted!\n");
}

Supporting this in a server is more difficult. The server is already in the middle of processing the request, potentially
already blocked itself. Ideally we could cancel the request but sometimes that isn’t possible.

Lets just say you can, your unblock handler could be as simple as:

int io_unblock(resmgr_context_t *ctp, io_pulse_t *msg, RESMGR_OCB_T *ocb)
{
	struct _msg_info	info;

	if (MsgInfo(ctp->rcvid, &info) != -1 && (info.flags & _NTO_MI_UNBLOCK_REQ)) {
		cancellation_flag = true;  // other code knows to check this periodically and cancel
		                           // if it's set.
	}
	return(_RESMGR_NOREPLY);
}

It’s important to do that MsgInfo check first because its possible that since getting the pulse the client may have already been replied to.

For the full docs on the QNX site visit http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/prog/resmgr.html#HANDLING_UNBLOCKING

Categories: QNX Tags:

QNX Videos

September 11th, 2007 No comments

Lots of exciting things coming from QNX these days. QNX released several new technical videos to YouTube today. Mine included is posted there although it isn’t that technical. Its good to start with an overview and I’ll get some more done in the future I’m sure.

Here is a list of current QNX Videos:

Instrumented Kernel – Collin Burgess

Momentics Overview – Doug Schaefer

QNX Multimedia Components – Dan Cardamore

Categories: QNX Tags:

Virtual Machine woes

September 10th, 2007 2 comments

My goals for setting up my development environment are:
– Keep code files off of virtual machines so that I can work on my laptop without killing the battery
– have full access to tools like gcc and gdb
– not too worried about using the IDE since I typically work with another editor

For a while it was difficult since I picked up one of the first Macbook Pro’s and at that time there were no virtual machine environments for it. Eventually came Parallels and then VMWare.

I started with setting up Mac OS X Tiger to be an NFS file server. Leopard is going to use /etc/exports to make this easy to do, but until then while you’re running Tiger your best bet is to use NFS Manager. I create a /w folder which I put all my source code checkouts and QNX stages into and when I mount it on my virtual machine it gets the same /w pathname. This way it doesn’t matter which system I’m on, its /w either way.

In my experience so far, parallels is very fast. Even single CPU it out performs VMWare Fusion 1.0 running QNX 6.3.0. Keep in mind however that parallels doesn’t support QNX and the standard 6.3.2 neutrino doesn’t run on Parallels. Colin Burgess managed to get the kernel running on Parallels and that worked well for a while. io-audio, io-net, io-graphics, and io-usb all work well on Parallels. The only problem is that its gotten quite unstable for me, I’m not sure if its because of a Parallels update that I’ve installed or not, but io-audio seems to hang now and then, and in addition parallels itself crashes fairly frequently.

VMWare is stable, io-audio, and io-net work. It has SMP which is good for testing multi-threaded access to applications. The downsides is that its a dog… it is very slow to compile compared to Parallels, somewhere in the order of 5-8 times slower which is very noticeable. And io-usb gives errors but I haven’t spent much time at all trying to get this working. Because parallels has gotten so unstable I’m going to spend a bit more time trying to get this working better.

Many months ago I had built the QNX toolchain on Mac OS X so that I could build QNX applications directly on Darwin. I’m going to take a crack at this again. The reason why I went away from this in the past was because I had only compiled GCC 3.3.4 and we typically ship 2.9.53 binaries so my executables were often incompatible. Parallels back then was very fast and stable and there was no big performance difference while building small apps on the virtual machine. Now that things have gotten so unstable or slow depending on virtual machine I choose I’m going to rebuild the toolchain for Darwin and do testing in VMWare.

One thing that is very nice about this problem, is that I have a choice :)

Categories: QNX Tags:

Welcome to Heads up QNX

September 6th, 2007 3 comments

This blog will be many things related to QNX. I’m in an excellent position in that I work at QNX, and I’m given full freedom to blog my thoughts and experiences at QNX on my own website.

To start off with, I’d like to introduce myself:

Hi, I’m Dan Cardamore.

I’m currently employed with QNX as a software developer and work in the multimedia team. I’ve been at QNX for almost three years now so I’m still fairly new to lots of QNX technologies, but on the bright-side if you’re reading this blog hopefully you’ll enjoy learning with me as I post my thoughts on subjects here.

As far as software development goes, I have to say that multimedia is a lot of fun. You can talk to anyone on the street or in your family regardless of age or technical understanding and say “I work on multimedia systems, like the CD player in your car only with color screens”. Our middleware software is called “MME” and stands for MultiMedia Engine and allows other developers to create multimedia applications quickly leveraging all the work we’ve done.

I’m not the usual developer at QNX. I use Mac OS X as my desktop OS rather than a supported development environment from QNX. As far as I know I’m the only one, but I hope someday that will change. QNX is an awesome OS, especially when you want to make an embedded product or you require real-time or multi-node capabilities, but I prefer a bigger fancier desktop OS. Linux is an excellent OS but its nowhere near as polished as Mac OS X for desktop use and doesn’t have the same application support. I won’t even bother mentioning what I think of Windows as a desktop.

Its late and I need to sign off, but in my next post I’ll talk more about my development environment and how I set it up.

Categories: QNX Tags: