views:

116

answers:

2

Could you help to understand generally how the applying of patch or an update works for already compiled and live application at the level of code?

I mean, if we want to fix an error (or improve a functionality) in some piece of code, what is happening with that already compiled code, how it gets changed?

+1  A: 

What you talk about is done with a binary diff algorithm.

Such an algorithm finds the differences between the existing binary file and the target binary file. That is usually a lot less space than sending the whole file again, thus it's faster. Speed is relevant if the updates you push are security related, becasue the faster clients get patched the less window of opportunity exploits have.

See this and this for the latest and greatest on binary diff algorithm implementations for compiled executables.

Vinko Vrsalovic
Thanks for the details, +1. Could all these be summed up as follows: general, common practice in updating app is just replacing executables, but sometimes somebody (Google for example) uses more advanced way of looking for and replacing parts of code that differ only?
rem
Yes, except that the replacing isn't of "parts of code", it is of parts of a binary file. Also, as Aaronaught said, game distributors usually distributes patches in this manner, as does Adobe IIRC. So it's more common than you might think. Especially when you have a lot of data and/or a lot of clients to push your update to.
Vinko Vrsalovic
+1  A: 

Most likely you're going to simply have to replace the binaries with the new compiled version and make sure they still work with all the dependent libraries as well.

Thomas Wanner
Thanks Thomas, +1. So, if I get distributive of Service Pack of some app and it has the size of 1 gb, it doesn't mean that there are changes in amount of all those 1 gb, but only that this is another copy of whole executable, previously installed, containing some changes only?
rem
It depends on the application but it is likely to be the case. Usually the executable doesn't have 1 giga, so the service pack can replace only the relevant libraries and probably the executable, which is probably still much smaller than the app size with all the resources.
Thomas Wanner