[pacman-dev] Paralellising integrity checks

Tavian Barnes tavianator at tavianator.com
Sat Feb 19 04:26:56 EST 2011


Integrity checking in pacman seems to be a CPU-bound embarrassingly
parallel task, so I'd like to spread it out over every available core
to speed it up.  To me it looks like both the delta and regular
package integrity checking loops in lib/libalpm/sync.c could be
parallelised.  But I've never messed with the pacman code before, so I
have a couple questions about your best practices:

- There doesn't seem to be any threading code in pacman/libalpm
currently; would using pthreads directly be okay, or should a
threading abstraction layer be created?
- There's no portable way to get the number of available cores.  Where
does platform-specific code go in libalpm?  The way to do it on Linux
is with sched_getaffinity(); sysconf(_SC_NPROCESSORS_ONLN) is almost
as good and works on BSD too I believe.

Also, I guess a major question would be: would this be likely to be
merged?  It's not a major issue, but it's also not a very large
change.  Every time there's a KDE update or something similarly large
I find myself wishing that all 2/4/24 of my cores were being used for
the the integrity checks.

-- 
Tavian Barnes


More information about the pacman-dev mailing list