Better HN
topnewbestaskshowjobs
Log inSign up

kqueue

265 karma · joined Apr 11, 2010 (16y ago) · 206 submissions

Submissions

comment 16y ago · link · parent

Thanks, exactly my thoughts.

152.

My version of youtube instant(primepie.com ↗)

20 points · by kqueue · 16y ago · 13 comments

comment 16y ago · link · parent

It can be improved, here's my version from a c program but can be used in objc in the say way.

http://pastebin.com/nbgdaGXJ

comment 16y ago · link · parent

I think procrastination is not the problem. It is an effect rather than a cause. I procrastinate waiting until I feel I can focus on the problem. Removing distractions won't help much. When I feel I can focus, nothing can distract me.

Probably what should be tackled is how to maintain focus, and regain focus quickly.

comment 16y ago · link · parent

self discipline and consistency.

comment 16y ago · link · parent

I don't think the author knows much about html5 or the concept of canvas in general.

If he goes to http://www.chromeexperiments.com/, he'll realize that all this is doable.

comment 16y ago · link · parent

"public album" might confuse users given that the title says "privately and in groups".

comment 16y ago · link · parent

I bet you most of the users did not notice this difference. What they noticed probably is speed, and the fact that you can scroll and move around the map without clicking the side arrows (mapquest style).

comment 16y ago · link · parent

You obviously don't know much about Python... and very little about programming.

comment 16y ago · link · parent

Learn Python and you'll notice why perl doesn't make sense.

comment 16y ago · link · parent

very few proxies support pipelining. You shouldn't be surprised at all. Try implementing pipelining in proxies and you'll figure that it isn't worth the effort.

comment 16y ago · link · parent

This feature exists for a long time now.

comment 16y ago · link · parent

From experience, my rule of thumb is to select projects that takes around one month to finish (give or take).

Any longer project will be a challenge to finish because you'll lose motivation (for various reasons).

Launching quickly will give you a lot of insight on whether you are on the right track or not. And if you are, this will motivate you to start improving what you have built and probably rewrite it sometime later.

Shrink your idea.

comment 16y ago · link · parent

so every time an app gets refused we have to whine and blog about it? bloggers are becoming obnoxiously louder every day.

comment 16y ago · link · parent

I know the author is showing that he is disappointed, but we all know he is proud, more than anything else.

comment 16y ago · link · parent

First, they copied Apple iPhone and created Android. Now they are going iPad and creating this tablet. Very innovative Google. very.

comment 16y ago · link · parent

Hmm, obviously you haven't written any serious http proxy/server that required to handle 10k+ of concurrent connections. Couple of thousands of sync connections is nothing in high performance servers.

There isn't much scheduling about coroutines, you wake up the coroutine on the event that it slept on (read/write/sleep), that's it. If you want to prioritize, you can do so, but with minimal advantage.

>Doing it efficiently is an art and the OS is a lot more efficient than you, even with all the context switching

At this point, I am pretty sure you don't understand context-switching and its implications, and you don't know how coroutines work.

comment 16y ago · link · parent

Threads are bad for highly concurrent systems that wants to run fast. Running 10000 threads will result in huge amounts of context-switching because it is the kernel's job to schedule the threads and run them.

Now compare that to coroutines, where you can switch between 10000 threads in the userland.

If you want to take advantage of cores when using coroutine, then run several coroutine schedulers, each in a pthread, and let them communicate over local sockets.

comment 16y ago · link · parent

I don't get it, why do you want to introduce new factors irrelevant to what you are testing (epoll vs poll)?

comment 16y ago · link · parent

When the kernel calls poll, poll will access memory in the kernel address space because that's where it is running. All the addresses accessed in any system call are in the kernel address space. They don't go back and forth and swap vm pointers to fetch data from other processes. That's not how kernels work. And no you cannot change poll().. You write epoll/kqueue

comment 16y ago · link · parent

When the kernel is executing a function call placed on the stack, all the addresses on the stack are assumed in the same vm space. It does not know that an address is actually a virtual memory address belonging to process X and tries to figure out the value in the physical memory.

comment 16y ago · link · parent

Sorry, I meant level-triggered. :) I think edge-triggered does add an extra overhead as you stated.

comment 16y ago · link · parent

The pointer referred to by the process is not accessible by the kernel because when the user process was running, it had a different vm space than the kernel vm space. So if it just passes the pointer (without copying the pointer's data), then the kernel will point to a virtual address that won't exist until the user process gets swapped in again.

comment 16y ago · link · parent

For the kernel to execute a system call, it has to place the arguments on its stack. a system call doesn't execute in the userland.

comment 16y ago · link · parent

Lets assume we have 20k opened FDs.

In case of poll(), you have to transfer this array of FDs from the userland vm to the kernel vm each time you call poll(). Now compare this with epoll() (let's assume we are using EPOLLET trigger), when you only have to transfer the file descriptors once.

You might say the copying won't matter, but it will matter when you have a lot of events coming on the 20k FDs which eventually leads to calling xpoll() at a higher rate, hence more copying of data between the userland and kernel (4bytes * 20k, ~80kbytes each call).

comment 16y ago · link · parent

I bet the government is interested in all the gossip that goes around on BlackBerry service.

comment 16y ago · link · parent

HN has really changed. This question is an example. This is not readdit.

comment 16y ago · link · parent

Event driven servers should not block on disk i/o, dns queries, or db calls [by using/writing async libs]. At least the well written ones. Else the Server Is likely to be dos-ed. The author is wrong in using a db call as an example. Secondly, the author totally ignored the time it takes to launch a thread vs not launching one at all in an event driven model and that affects the # of new connections/sec. Finally, switching between threads is not a very cheap operation since it causes a context switch, which directly affect the response time of the server.

comment 16y ago · link · parent

Facebook is not about features anymore. It is about the fact that they have 500M users. When you want to compete with Facebook, you have to grab 30% from the 500M to your side to call it a competition. You have to convince them that you have a better service and that they won't miss the people that are still on Facebook.

P.S. 1% of Facebook users care about privacy. The rest are not aware.

comment 16y ago · link · parent

Pick the simplest idea and implement it in one month.

Sometimes what you think might be cool can turn out to be boring, but only after you have wasted a year on it.

1234567