A method for traffic shaping of a packet switched network, the method including processing of packets to be transmitted in said network characterised by: a serial packet processing algorithm (A ser) providing a synchronized utilization of a set (S PU; 150) of at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n), wherein only one of said at least two processing units (PU 1; PU 2;..., PU n; 151; 152;...; 15n) processes the packets at a given time and the packets are processed one by one in a synchronized manner; and - a parallel packet processing algorithm (A par) providing an at least partly unsynchronized utilization of said set (S PU; 150) of said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n), wherein said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n) process the packets in parallel in an at least partly unsynchronized manner; wherein - said processing of said packets corresponds to a total packet cost (C tot), which is cooperatively shared by said at least two processing units (PU 1, PU 2,... PUn; 151, 152,..., 15n) of said set (S PU; 150); - determining, when said processing according to said parallel packet processing algorithm (A par) is used for processing said packets, if shares (C 1, C 2,..., C n) of said total packet cost (C tot) for one or more of said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n) exceed a capacity to process packets for said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n), respectively, wherein each one of the shares (C 1, C 2,..., C n) corresponds to one or more packets; and - switching from said processing according to said parallel packet processing algorithm (A par) to processing according to said serial packet processing algorithm (A ser) if said shares (C 1, C 2,..., C n) of said total packet cost (C tot) for one or more of said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n), respectively, is determined to exceed said capacity. a serial packet processing algorithm (A ser) providing a synchronized utilization of a set (S PU; 150) of at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n), wherein only one of said at least two processing units (PU 1; PU 2;..., PU n; 151; 152;...; 15n) processes the packets at a given time and the packets are processed one by one in a synchronized manner; and - a parallel packet processing algorithm (A par) providing an at least partly unsynchronized utilization of said set (S PU; 150) of said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n), wherein said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n) process the packets in parallel in an at least partly unsynchronized manner; wherein - said processing of said packets corresponds to a total packet cost (C tot), which is cooperatively shared by said at least two processing units (PU 1, PU 2,... PUn; 151, 152,..., 15n) of said set (S PU; 150); - determining, when said processing according to said parallel packet processing algorithm (A par) is used for processing said packets, if shares (C 1, C 2,..., C n) of said total packet cost (C tot) for one or more of said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n) exceed a capacity to process packets for said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n), respectively, wherein each one of the shares (C 1, C 2,..., C n) corresponds to one or more packets; and - switching from said processing according to said parallel packet processing algorithm (A par) to processing according to said serial packet processing algorithm (A ser) if said shares (C 1, C 2,..., C n) of said total packet cost (C tot) for one or more of said at least two processing units (PU 1, PU 2,..., PU n; 151, 152,..., 15n), respectively, is determined to exceed said capacity.