JOHANNESBURG — In the darkened and chilly parking lot of a mall, a suburban family huddling around a shopping cart shared a snack on a Friday evening out. After finding their favorite restaurant closed because of a blackout, Buhle Ngwenya, with her two sons and two nephews, settled for meat pies from one of the few stores open in the mall.

“It’s like death, this load shedding,” Ms. Ngwenya, 45, said, referring to the blackouts imposed by South Africa’s state utility to prevent a collapse of the national electricity grid.

With winter here in South Africa, the worst blackouts in years are plunging residents into darkness in poor townships and wealthy suburbs alike. The cutoffs have dampened the economy, Africa’s second biggest, and are expected to continue for another two to three years.

Despite a decade of strong economic expansion, sub-Saharan Africa is still far behind in its ability to generate something fundamental to its future, electricity, hampering growth and frustrating its ambitions to catch up with the rest of the world.